Вопрос по regex, php – preg_replace () [function.preg-replace]: неизвестный модификатор '/' в / home /

0

Error: User Rate Limit Exceeded

www.abc.comError: User Rate Limit Exceededhttp://abc.comError: User Rate Limit Exceeded

http://www.XXXXXX.com/sonal?www.abc.com

Error: User Rate Limit Exceeded

http://www.XXXXXX.com/sonal?http://abc.com

Error: User Rate Limit Exceeded

Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in /home/XXXXX/public_html/YYYYYYYYY/KKKKKK.php on line 495

<code>$search_array = array(
   "/\[url]www|http://.([^'\"]*)\[\/url]/iU",
   "/\[url]([^'\"]*)\[\/url]/iU",
   "/\[url=www|http://.([^'\"\s]*)](.*)\[\/url]/iU",
   "/\[url=([^'\"\s]*)](.*)\[\/url]/iU"
);
$replace_array = array(
   "<a href=\"http://XXXXXX.com/sonal?.\\1\" target=\"_blank\" rel=\"nofollow\">www.   \\1</a>",
   "<a href=\"\\1\" target=\"_blank\" rel=\"nofollow\">\\1</a>",
   "<a href=\"http://XXXXXX.com/sonal?.\\1\" target=\"_blank\" rel=\"nofollow\">\\2</a>",
   "<a href=\"\\1\" target=\"_blank\" rel=\"nofollow\">\\2</a>"
);

$msg = preg_replace($search_array, $replace_array, $msg);
return $msg;
</code>
Error: User Rate Limit Exceeded Steeve
Error: User Rate Limit Exceeded/Error: User Rate Limit Exceededhttp: Hamish
Error: User Rate Limit Exceededhttp://Error: User Rate Limit Exceededhttp:\/\/Error: User Rate Limit Exceeded Aziz
"after http:" deceze♦

Ваш Ответ

2   ответа
6

$search_array = array(
  "/\[url]www|http:\/\/.([^'\"]*)\[\/url]/iU",
  "/\[url]([^'\"]*)\[\/url]/iU",
  "/\[url=www|http:\/\/.([^'\"\s]*)](.*)\[\/url]/iU",
  "/\[url=([^'\"\s]*)](.*)\[\/url]/iU"
);

$search_array = array(
  "#\[url]www|http://.([^'\"]*)\[\/url]#iU",
  "#\[url]([^'\"]*)\[\/url]#iU",
  "#\[url=www|http://.([^'\"\s]*)](.*)\[\/url]#iU",
  "#\[url=([^'\"\s]*)](.*)\[\/url]#iU"
);
Error: User Rate Limit Exceeded Steeve
4
"/\[url]www|http://.([^'\"]*)\[\/url]/iU",
 ^               ^^                  ^

//\/\/

"~\[url]www|http://.([^'\"]*)\[/url]~iU",
Error: User Rate Limit Exceeded Steeve
Error: User Rate Limit Exceeded Steeve

Похожие вопросы