【发布时间】:2021-06-28 09:50:13
【问题描述】:
我需要在文本中找到最后一个匹配词“Madhuparna”,并获取左侧接近匹配标记 html 到文本中最后一个标记 html 之间的文本。
- 要查找的单词:
Madhuparna
- 文字输入:
<p>The entire purpose speed up the process.</p><p>June 5, 2021 By Demo</p>\r\n<p>The entire purpose of a terminal emulator is to imitate how the regular computer terminals perform</p><p>Allowing the main computer to connect Madhuparna to and use a remote computer</p><li>bla bla bla bla bla bla</li>
- 我需要的结果:
<p>Allowing the main computer to connect Madhuparna to and use a remote computer</p><li>bla bla bla bla bla bla</li>
- 我现在必须做但不能工作:
/<(\S+)(>| .*?>)[^<>]*Madhuparna[^<>]*<\/\1>/g
【问题讨论】: