I'm having problems with regex and can't get a value to be validated.
I have a function like this:
function validationObject(validationName, validationRegEx) {
this.validationName = validationName;
this.validationRegEx = validationRegEx;
}
It creates a validationObject with the parameters it gets. For a dropdownlist containing a number I have this regex:
\d+
But when I validate the value with this regex with this piece of code it won't work:
if (inputValue.match(validatingRegex)) {
doSomeThings();
}
If I check for the validationObject I see that Chrome has changed the regex to /d+/ . I've tried setting it to a regex-type, but it doesn't work either. This does work on textfields. It seems to me that all backslashes get converted to something else.
Also I've tried escaping the backslash but then the browser just takes the literal value.
Hopefully you have an answer, thanks for your help!
Best regards,
Boyyerd