tags:

views:

109

answers:

3

I had just got a similar (but not exact) question answered. I now need help with this question below.

I want to write a regex to match a character if its a non word, non digit and non star (*) character. So, the characters [0-9][a-z][A-Z] * should not match and any others should.

I tried writing [\W[^*]] but it doesn't seem it works.

I hope I made it clear. but if not, I apologize. Thanks much for the help.

+3  A: 

Try this instead:

[^\w\*]
Zach Scrivena
+1  A: 

The simplest regular expression that matches a single character, that is not one of those you described, independent of any particular regular-expression extensions, would be:

[^0-9a-zA-Z *]
Tom Alsberg
+3  A: 
[^\w\*]

Simple enough.