Regular Expressions for PHP hyperlinks!?
http://detail.tmall.com/item.htm?id=18796056163
http://item.taobao.com/item.htm?spm=a220z.1000881.0.82&id=19150004171
http://item.taobao.com/item.htm?id=16181772778
Such links are reserved id= .... Parts, and the others are replaced by
Javascrpit:clickitem ("18796056163");
Javascrpit:clickitem ("19150004171");
Javascrpit:clickitem ("16181772778");
------Solution--------------------
Such a regular URL, with explode, it can be. Reference
http://www.php.net/manual/zh/function.explode.php
$part = Explode (' id= ', ' http://detail.tmall.com/item.htm?id=18796056163 ');
echo $part [1];
------Solution--------------------
PHP Code
if (Preg_match ("/id=[\d]+$/", $url, $result)) { echo $result [1];}
------Solution--------------------
PHP Code
$s =<<
------Solutions--------------------
$s = <<
<>
A
B
C
D
E
F
TEXT;
echo preg_replace ('/href= '. +?item\\.html?. *? [^\\w]id= ([0-9]+) (. *) "/i", ' href= "Javascrpit:clickitem (\ ' $1\ ')" ', $s);