I am new to regexp in php. I am just trying to do a simple preg_match on two strings. Here is my code:
$pattern = '\\w*'.strtolower($CK);
if(preg_match($pattern, $rowName, $matches) == true)
{
echo 'true';
}
But I keep getting the error:
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /home/daskon/public_html/reflexInvestor_dev/php/rss_functions.php on line 319
I imagine it’s because I need to put something after the pattern, but I can;t seme to find what that is. When I try the same pattern in a regexp tester, it works fine.
You need to wrap the pattern in delimiting characters (I like to use
#since I rarely need them inside of the regex):(You also don’t need the
== true, it’s redundant since that’s what the if does anyway internally…)