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-
jax0Asked:
Who is Participating?
 
Pui_YunConnect With a Mentor Commented:
Hi jax0,
This took a bit of trial and error, but the following regex seems to work for me.  I tested it with:
abccabcabdabc

and it gives me:
c
abd

which looks good for me.

Hope this helps.
P.
(?:.(?<!abc))+?(?=abc|\z)

Open in new window

0
 
brad2575Commented:
This should match any letters but a, b, or c
(^-?[d-zD-Z]*$)
0
 
HackneyCabCommented:
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.
0
 
Pui_YunCommented:
No problem, I hope it comes in handy :)

P.
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.