Html 使用记事本++;
我试图从HTML代码片段中提取一个子字符串,如下所示:Html 使用记事本++;,html,regex,notepad++,Html,Regex,Notepad++,我试图从HTML代码片段中提取一个子字符串,如下所示: some text here. some text here.<img src="//zhihu.com/equation?tex=m_%7Bt%2B1%7D" alt="m_{t+1}" eeimg="1">some text here.<img src="//zhihu.com/equation?tex=p_t%3DE_t%28m_%7Bt%2B1%7Dx_%7Bt%2B1%7D%29" alt="p_t=E_t(m_
some text here. some text here.<img src="//zhihu.com/equation?tex=m_%7Bt%2B1%7D" alt="m_{t+1}" eeimg="1">some text here.<img src="//zhihu.com/equation?tex=p_t%3DE_t%28m_%7Bt%2B1%7Dx_%7Bt%2B1%7D%29" alt="p_t=E_t(m_{t+1}x_{t+1})" eeimg="1">some text here.
(<img(.+?) alt="((?!eeimg).)*" eeimg="1">)
这里有一些文本。这里有一些文字。这里有一些文字。这里有一些文字。
为了绘制第一个img
标记中包含的子字符串m{t+1}
和p\u t=E\u t(m{t+1}x{t+1})
在第二个标记中,我只在记事本++中使用了一个regexp
,但表达式与两个img
标记不单独匹配,它只显示了一个包含整个HTML片段的结果
谁能给我指一条正确的路吗
谢谢。您可以制作。+非贪婪添加?你可以这样说:
some text here. some text here.<img src="//zhihu.com/equation?tex=m_%7Bt%2B1%7D" alt="m_{t+1}" eeimg="1">some text here.<img src="//zhihu.com/equation?tex=p_t%3DE_t%28m_%7Bt%2B1%7Dx_%7Bt%2B1%7D%29" alt="p_t=E_t(m_{t+1}x_{t+1})" eeimg="1">some text here.
(<img(.+?) alt="((?!eeimg).)*" eeimg="1">)
()
希望它对您有所帮助谢谢,这正是我所期望的。您要用什么替换这个正则表达式?