I am trying to use a validator on a input text for a file name using a regexp.
This is the regexp /^[^<>:"\/\\|?*]*$/gi
This is the test site https://regex101.com/r/4hdrzh/2
It should return false if any of the chars in []
are present.
While using FormValidation (https://formvalidation.io/) slightly older version, I see the following behaviour
- If I have ANY invalid character (eg, : \ etc) the input will always be invalid (great)
- If I have ONLY valid characters, the validator says that the field is invalid and then valid after each character I type (bad)
Example
"a" -> valid
"ab" -> invalid
"abc" -> valid
"abcd" -> invalid
It's swapping between valid/invalid for no reason.
Is this is a regexp issue or the formvalidator plugin?