Does anyone know what is wrong with this regex? It works fine on sites like RegexPal and RegExr, but in PHP it gives me this warning and no results:
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash
Here’s my code:
preg_match('name="dsh" id="dsh" value="(.*?)"', 'name="dsh" id="dsh" value="123"', $matches);
You have no delimiter. Enclose the pattern in
/For patterns that include
/on their own, it is advisable to use a different delimiter like~or#to avoid escaping: