# RED.validators.regex() custom message?

**URL:** <https://discourse.nodered.org/t/red-validators-regex-custom-message/95116>\
**Category:** Developing Nodes\
**Created:** [4 February 2025 16:46 UTC](https://discourse.nodered.org/t/red-validators-regex-custom-message/95116 "2025-02-04T16:46:35Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [4 February 2025 17:36 UTC](https://discourse.nodered.org/t/red-validators-regex-custom-message/95116/3 "2025-02-04T17:36:03Z")

</div>

Thanks for getting back Nick.

Perhaps common is a bit strong 😉 but there were a few along similar lines -

> [@typedInput - enforcing only string output from JSONata type](https://discourse.nodered.org/t/typedinput-enforcing-only-string-output-from-jsonata-type/75393):
>
> Hi Node-RED brains-trust. I need to validate a typedInput that allows JSONata BUT I need the result to be a string not JSON. I can do this with a validate function: const f = value.slice(0, 1) return !( f === '{' || f === '[') Which does mark the node as invalid HOWEVER, when I open the config panel for the node, it does NOT highlight the field in error. [image] This is in error for example and so should be highlighted in red. How can I do this? I see that there is a RED.validate.typedInp…

As you probably noticed I'm working a souped-up version of your annotate node.

As there is the possibility to directly type a hex value into the colour picker, I though it best to validate this. However although it marks an error on the node, the input element that gets the error class is a hidden object.

The code you shared should be a least a help to know which picker has the incorrect value, thanks.

---

_[View the full topic](https://discourse.nodered.org/t/red-validators-regex-custom-message/95116)._
