Home > Backend Development > PHP Tutorial > 正则匹配不包含某字符串的字符串

正则匹配不包含某字符串的字符串

WBOY
Release: 2016-06-06 20:33:07
Original
1290 people have browsed it

除了前面两个连续&nbsp<br>,其他的<br>全部匹配,请教正则应该怎么写?

<code>  <br>  #不匹配
</code>
Copy after login
Copy after login

回复内容:

除了前面两个连续&nbsp<br>,其他的<br>全部匹配,请教正则应该怎么写?

<code>  <br>  #不匹配
</code>
Copy after login
Copy after login

/(?)+/

试试这个:/  <br>((<br>)*)/

<code>var matches = '  <br><br><br><br>'.match(/  <br>((<br>)*)/);
// matches[1] => "<br><br><br>"
</code>
Copy after login

b.t.w, 偶的正则比较水,坐等楼下大牛解答

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