Home >Backend Development >PHP Tutorial >一下一个正则表达式

一下一个正则表达式

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:09:38936browse

求助一下一个正则表达式
需要匹配的字符串为:bbabbbbabc11
我想匹配到后面的abc11
用a(.+?)11的话, 会匹配到abbbbabc11

因为a和11中的字符不确定长度, 只想匹配最后的, 请问用一个正则的话, 有什么好办法。 
------解决思路----------------------

var str="bbabbbbabc11";<br /><br />var reg=/a[^a]*11/;<br /><br />alert(reg.exec(str));

------解决思路----------------------
$s = 'bbabbbbabc11';<br />$p = '/a[^a]+11/';<br />preg_match($p, $s, $m);<br />print_r($m);
Array<br />(<br />    [0] => abc11<br />)<br /><br />

Statement:
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