如何使用php脚本的正则表达式提取itemid=后面变量3这个值?我现在用的是PHP code preg_match_all('/buy"/> 如何使用php脚本的正则表达式提取itemid=后面变量3这个值?我现在用的是PHP code preg_match_all('/buy">

大侠进!正则表达式小语句~

WBOY
Release: 2016-06-13 13:08:38
Original
815 people have browsed it

大侠进!求一个正则表达式小语句~~~
各位大侠~
求教一个正则表达式的提取方法:
下面这个地址

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->http://www.daikuan.com/sell/show.php?itemid=3">
Copy after login

如何使用php脚本的正则表达式提取itemid=后面变量3这个值?
我现在用的是
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->preg_match_all('/buy\/show\.php\?itemid=([\'"]?)(\d+)\1(?-i)/', $arrContent[0], $itemidx);
Copy after login

但是这个值没有提取出来。。。
这么办?

------解决方案--------------------
/http:\/\/.*?\?itemid=(\d*)/
没见到括号分组么
------解决方案--------------------
print_r($itemidx);//就知道了

echo $itemidx[1][0] ; //就是了
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!