one of regular expressions raises warnings , can't figure out why or how change expression works fine. have escape anything? if yes, why , how? better understand...
$output = preg_split("/($begindelimiter|$enddelimiter)/", $text); php warning: preg_split(): compilation failed: missing ) @ offset 15 in /home/tim/importer.php on line 539
thanks help!
edit: $begindelimiter contains srf53 $enddelimiter contains (
the second 1 must problem, understand... needs escaped.
use preg_quote, variables contains special characters need escaped in regex.
preg_quote()takes string , puts backslash in front of every character part of regular expression syntax. useful if have run-time string need match in text , string may contain special regex characters.
$output = preg_split("/(".preg_quote($begindelimiter)."|".preg_quote($enddelimiter)."/", $text);
Comments
Post a Comment