Not Allowing Specific Character in Regular Expression

Is it possible to specify that you don't want a specific character at a specific position in a regular expression?

In otherwords I want it to return true if the string is "blahblahblah" but not if it is blahblahblah[" and only that one character should be disallowed.
LVL 4
jfredricksonAsked:
Who is Participating?
 
amit_gCommented:
/blahblahblah[^[]/

[^abcd] matches anything but abcd.
0
 
jfredricksonAuthor Commented:
Is there no way to only specify that you don't want that specific character?
0
 
jfredricksonAuthor Commented:
Doh! Misread that. Looks perfect, thanks.
0
 
amit_gCommented:
Thats exactly what it is. [^[] would match any character but [ i.e. the reg ex would not match if there is a [ in it (in turn disallowing it).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.