Home > Backend Development > PHP Tutorial > 请教PHP用正则表达式,下面这种情况

请教PHP用正则表达式,下面这种情况

WBOY
Release: 2016-06-13 11:35:16
Original
943 people have browsed it

请问PHP用正则表达式,下面这种情况?
一个项目中可能出现以下两种情况,

第一种:
........SADFA:

    123

SLDKJLSKDFJ.........

第二种:
........SADFA:
                                               0

SLDKJLSKDFJ.........

请问大侠们,有没有办法用一个正则表达式就表示了啊?
我想的:
preg_match("/SADFA:.*?(\d+)/is",$text,$reg);
这样结果就拿到javascript:void(0)里面这个0了,
改成下面的:
preg_match("/SADFA:.*?([1-9]\d*)/is",$text,$reg);
可以拿到红色部分的数字,但是红色部分是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