Link to home
Start Free TrialLog in
Avatar of jax0
jax0

asked on

Php regex [^abc] as group not individual letters

I understand that a regex written like:

[^abc]

means any character except a, b or c can appear once.

But how would I write the regex to equal any character except abc "as a group" and not individual letters.

I've already tried:

([^a][^b][^c])  didn't work.
([^abc])        didn't work.

can someone please assist?
thx
D-
Avatar of brad2575
brad2575
Flag of United States of America image

This should match any letters but a, b, or c
(^-?[d-zD-Z]*$)
ASKER CERTIFIED SOLUTION
Avatar of Pui_Yun
Pui_Yun
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you, Pui_Yun, I'd not yet discovered that you can use NOT patterns (negative assertions) in PCRE.

http://php.net/manual/en/regexp.reference.assertions.php

That will come in handy, no doubt.
No problem, I hope it comes in handy :)

P.