I’m new to regular expressions and am trying to find a string using preg_match, here’s my code:
$artist = $row['ARTIST'];
$bool = preg_match("/$artist/", $description, $match);
My error is:
Unknown modifier 'C' in ...
If anyone could tell me what I’m doing wrong I’d appreciate it, thanks.
You have to escape possible special characters in your variable:
preg_quote() in the PHP Manual:
Hint: try echoing your
$artistvariable and you should see which character is causing the problem