I had this regular expression:
preg_match("|[\|()<>%*+=]|(=)+(!)|[-]{2}|", $status, $array);
that generates this warning
Warning: preg_match(): Unknown modifier '(' in...
I know that is a problem of \
but I don't know where to put them.
I had this regular expression:
preg_match("|[\|()<>%*+=]|(=)+(!)|[-]{2}|", $status, $array);
that generates this warning
Warning: preg_match(): Unknown modifier '(' in...
I know that is a problem of \
but I don't know where to put them.
The problem is that you are using |
as the delimiter for the pattern, so the second |
ends the pattern and the (
is interpreted as a modifier. Do one of these, depending on if you need the |
at the beginning and end:
preg_match("/|[\|()<>%*+=]|(=)+(!)|[-]{2}|/", $status, $array);
preg_match("/[\|()<>%*+=]|(=)+(!)|[-]{2}/", $status, $array);
The is some problems... Let see:
Yours:
"|[\|()<>%*+=]|(=)+(!)|[-]{2}|"
^ first problem not needed as is an OR and there is nothing before it
^ you have to scape the parentesis all of it
^ you have to scape the asterisk
^unecessary there is nothing after
So the result would be:
"/[\|\(\)<>%\*+=]|(=)+(!)|[-]{2}/"