我在这里打败了这匹死马:
<p style='margin: 5px 0;'>I wan't be matched!</p>
<p style='margin: 5px 0;'>me 2!</p>
<ul>
<li>
<b>Lorem</b>
ipsum sit dolor amet
</li>
<li>
<b>Lorem</b>
ipsum sit dolor amet
</li>
<li>
<b>Lorem</b>
ipsum sit dolor amet
</li>
<li>
<b>Lorem</b>
ipsum sit dolor amet
</li>
<p style='margin: 5px 0;'>can i haz regex</p>
<p style='margin: 5px 0;'>NO! you can't</p>
<li>
<b>Lorem</b>
ipsum sit dolor amet
</li>
<ul>
从那我需要一个改变所有的正则表达式
<p style='margin: 5px 0;'>can i haz regex</p>
在标签之后并将其转换为
<li>can i haz regex</li>
就这么简单,但考虑到我是正则表达式的真正菜鸟,我无法完成它。
我正在尝试用look behind expression,但没有成功
(?m:(?<=(.*?<ul>.*?)(<p style='margin: 5px 0;'>.*?</p>)+)
我试图弄清楚大约 2 小时,但我似乎无法让它发挥作用。所以提前感谢任何可以解释我应该如何解决这个问题的人。:)