Reputation: 35349
I'm writing a small script (similar to SO's tag RegEx) that only allows the following characters: [a-z 0-9 + # - .]
But I can't figure out the right syntax:
I've come up with this:
ReReplace(myString, "[A-Z]", "", "ALL")
which removes capital letters. I'm not sure how to include the special characters in the expression, however.
The ReReplace() I'm using is a ColdFusion function.
Upvotes: 1
Views: 3122
Reputation: 15961
[^a-z0-9+#\-.]
should work. The ^
symbol within the []
means "Everything that's not in this list".
I'm not 100% on ColdFusion and if you'll need to escape the #
but if you find any issues, just escape the other special characters.
Upvotes: 7