I have a string !!test
or !!!!! testing
.
What I want to be able to do is use preg_replace()
and only keep the first !
but keep the rest of the text after that first !
that is not a !
!!test
-> !test
$str = preg_replace('/!+/', '!', $str);
Replace multiple !
s with a single !
.
http://www.regular-expressions.info/ has some great tutorials and references for learning regular expressions.