[英]find '== text ==' with regex
I just can't figure out how to find all '== foo ==' without getting all the '==== bar ===='. 我只是无法弄清楚如何找到所有'== foo =='而没有得到所有'==== bar ===='。 Using
^={2}.*={2}$
doesn't work for some reason. 使用
^={2}.*={2}$
由于某种原因不起作用。 Maybe because i want to find multiple strings like '== foo ==' within one text. 也许是因为我想在一个文本中找到多个字符串,如'== foo =='。
for example: 例如:
"== foo ==
lorem ipsum
== bar ==
==== bar ===="
should only return == foo ==
and == bar ==
应该只返回
== foo ==
和== bar ==
Add negative look-arounds for extra =
: 为extra
=
添加负面外观:
(?<!=)== \w+ ==(?!=)
Demo: https://regex101.com/r/7u7590/2 演示: https : //regex101.com/r/7u7590/2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.