How do I use a variable template with preg_match?
I do not know if there is enough data to submit, but I have
preg_match ('/ SAMPLETEXT /', $ bcurl, $ cookie1);
and I was wondering if I can do this
preg_match ($ newfunction, $ bcurl, $ cookie1);
but when i do that i get this error: "Warning: preg_match () [function.preg-match]: separator must not be alphanumeric or backslash in".
How can I get it to check my new function and not only check for "SAMPLETEXT".
source to share
Try preg_match("/$newfunction/", $bcurl, $cookie1);
so that you provide the delimiters you require (using a delimiter that will not be in $ newfunction).
But note that the documentation says, βDon't use preg_match () if you only want to check if one line is contained in another line. Use strpos () or strstr () instead, as they will be faster.
source to share