J'ai essayé de convertir directement une expression "eregi" en une expression "preg_match".Mon expression PHP preg_match ne fonctionne pas
$ACCEPT_CHARS = "a-z0-9_~#&;=./?+-";
$msg = preg_match("/ (http|https|ftp|gopher|news)://([$ACCEPT_CHARS]+)/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $msg);
Cependant, je reçois:
Warning: preg_match() [function.preg-match]: Unknown modifier '&' in /var/www/comm.borealisbbi.org/includes/functions_parse.php on line 282
Qu'est-ce que je fait de mal?
La ligne originale était:
$msg = eregi(" (http|https|ftp|gopher|news)://([$ACCEPT_CHARS]+)", "<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $msg);