Is it possible to iterate through the list of characters in a regular expression? A RegExp object looks suspiciously like a string. I wonder if it has similar properties.
I'm using a regular expression to check for invalid characters in user text input. If I hit an invalid character I want to list all the invalid characters for the user via "alert()". Rather than keep a separate string object in sync with the RegExp object (as my list of invalid characters grows over time), I want to simply display all the values defined in the regular expression.
I realize it may not be practical if I use "shorthand" such as [a..z]. Given the limited number of invalid characters, I intend to explictly list them all; such as
TIA
I'm using a regular expression to check for invalid characters in user text input. If I hit an invalid character I want to list all the invalid characters for the user via "alert()". Rather than keep a separate string object in sync with the RegExp object (as my list of invalid characters grows over time), I want to simply display all the values defined in the regular expression.
I realize it may not be practical if I use "shorthand" such as [a..z]. Given the limited number of invalid characters, I intend to explictly list them all; such as
Code:
var InvalidChars = new RegExp ("\"|\\'");
Comment