preg_match(); - Unknown modifier '+' [duplicate]
You need to use delimiters with regexes in PHP. You can use the often used /
, but PHP lets you use any matching characters, so @
and #
are popular.
If you are interpolating variables inside your regex, be sure to pass the delimiter you chose as the second argument to preg_quote()
.
This happened to me because I put a variable in the regex and sometimes its string value included a slash. Solution: preg_quote.