001priyank
001priyank

Reputation: 517

Regular Expression query

Please tell the regular expression for checking words that contains except /\:*?"<>| Also please tell I am trying

[a-z0-9A-Z]*^[:*?\"<>|]+[a-z0-9A-Z]*

what this is doing?.. Thanks

Upvotes: 0

Views: 103

Answers (3)

Akshatha
Akshatha

Reputation: 597

i think u need to add "\" symbol inside the bracket as * ? ^ are having special meaning ^[^/\:*?"<>|]

try it i am not sure........

Upvotes: 0

user626201
user626201

Reputation: 1682

The expression:

[a-z0-9A-Z]*^[:*?\"<>|]+[a-z0-9A-Z]*

is broken down into comparisions.

Firstly:

a-z0-9A-z

this matches all characters that are between a-z, 0-9 and A-Z in the alphabet

Then:

 [<snip>]*

this matches more 0 or more i.e. it will match 0 or more characters between a-z, 0-9 and A-Z.

Then '^' means start of line and '+' means match 1 or more i.e. it will fail with 0 matches whereas '*' will pass.

Apply the above to your expression and you can see what it matches.

Upvotes: 0

hsz
hsz

Reputation: 152216

Maybe try with:

^[^/\:*?"<>|]+$

Upvotes: 1

Related Questions