|OK - lets go about this analytically:
It works for A-Za-z0-9
Now add just one of your special characters at a time and see which, if any work - or what we're really looking for - is which one is breaking your string.
Note, also, that shortcuts exist for standard numeric and alpha ranges:
[^] And, if I read it correctly, '\w' is the equivalent of '0-9A-Za-z' and the do mention the hyphen character, as well.
- \d – is the same as [0-9]
- \w – is the same as [a-zA-Z0-9_],
- \s – is the same as [\t\n\v\f\r ], plus few other rare unicode space characters.
Comes from that page.
Find out the character that's killing you. It will help you remember three things (1) how to hunt for the problem (2) when you find the bad actor(s), why they're bad, (3) burn it into your mind so it is not only remembered but parallel problems are identified in advance.
|Ravings en masse^|
|"The difference between genius and stupidity is that genius has its limits." - Albert Einstein|
|"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010|