Running this error while adopting preg_mathc in php? Just check if the delimiters are not used in your string – mostly this would fix the problem.
$example = "<root><tag1>content1</tag1></root>"; $pattern = "/<tag1>.+</tag1>/"; preg_match($pattern, $example, $matches) ;
If you run the above snippet, you would run the error as the delimiter ‘/’ is the part of the string – so changing the delimiter, say, to ‘?’ would solve the problem. like
$pattern = "?<tag1>.+</tag1>?
Hope it would help.