I need to simplify the following regular expression to include all the letters of the alphabet:
(a{3})|(b{3})|(c{3})|(z{3})|(A{3})|(B{3})|(C{3})|(Z{3})
Use backreferences. Eg. in sed:
\([a-zA-Z]\)\1\1
or in PERL regular expressions
([a-zA-Z])\1\1
A regular expression using backreferences would be suitable.
([a-z])\1{2}
So something along the lines of preg_match('/([a-z])\1{2}/i', $string); would suffice.
preg_match('/([a-z])\1{2}/i', $string);