My PHP preg_match expression isn't working

pOuytSw

New Member
I tried to directly convert an "eregi" expression to a "preg_match" expression.\[code\]$ACCEPT_CHARS = "a-z0-9_~#&;=./?+-";$msg = preg_match("/ (http|https|ftp|gopher|news)://([$ACCEPT_CHARS]+)/i", "<a href=http://stackoverflow.com/"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $msg);\[/code\]However, I get:\[code\]Warning: preg_match() [function.preg-match]: Unknown modifier '&' in /var/www/comm.borealisbbi.org/includes/functions_parse.php on line 282\[/code\]What have I done wrong?The original line was:\[code\] $msg = eregi(" (http|https|ftp|gopher|news)://([$ACCEPT_CHARS]+)", "<a href=http://stackoverflow.com/"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $msg);\[/code\]
 
Back
Top