欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

求一正则匹配解决思路

程序员文章站 2024-01-30 22:13:40
...
求一正则匹配
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

把13,15,18开头的踢出去
求正则
------解决方案--------------------
$s=[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
html;
preg_match_all('/^(?!13
------解决方案--------------------
15
------解决方案--------------------
18).+/m',$s,$m);
print_r($m);

------解决方案--------------------
$s =[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
TXT;

//方案一
preg_match_all('/^(?!13
------解决方案--------------------
15
------解决方案--------------------
18).*/m', $s, $r);
print_r($r);

//方案二
echo preg_replace('/^(13
------解决方案--------------------
15
------解决方案--------------------
18).*?/m', '', $s);
Array
(
[0] => Array
(
[0] => [email protected]
[1] => [email protected]
[2] => [email protected]
[3] => [email protected]
[4] => [email protected]
[5] => [email protected]
[6] => [email protected]
)

)
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
求一正则匹配解决思路

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频