I have a requirement to not allow illegal characters in a filename, but to allow an apostrophe (single quote), underscore, and comma. My custom pattern is as follows:
-?[ a-zA-Z0-9]*[ a-zA-Z0-9_\-\s\.\\,]+
This works perfectly, but if I try to add a single quote either escaped or not escaped, I receive
an invalid pattern error.
I have Googled until my brain is about to explode. I have seen one other person ask about this and copied the single quote from a word doc then pasted it in, but no response on the outcome.
I tried to follow suit, and although it pasted and did not throw the error, it does not recognize the single quote and will not allow it. Has anyone out there found a solution to this? Most regex languages will allow a single quote without ever escaping it.
Any insight on this would be much appreciated!