A plugin allows me to use regular expressions for data validation like so:
<input type="text" data-validation-regexp="/red/i" data-validation="custom">
However instead of entering the regular expression in it's expected format for what I want to achieve which is /red/i
- I have had to simply enter the string red into the attribute like so data-validation-regexp="red"
in order to get the validation to function. This only tests for the lower case word 'red' though, whereas I want it to be case insensitive and for the 'i' modifier to be honoured.
This raises the question are there any alternative ways to write (I have endlessly played with this and had little success):
/red/i