【发布时间】:2015-02-07 13:26:20
【问题描述】:
如何删除正则表达式 Yahoo 管道中第一个 br 标记之前的所有内容?
正则表达式模块
in [item.description] replace [.+(<br>)] with [mytext]
【问题讨论】:
标签: regex yahoo-pipes
如何删除正则表达式 Yahoo 管道中第一个 br 标记之前的所有内容?
正则表达式模块
in [item.description] replace [.+(<br>)] with [mytext]
【问题讨论】:
标签: regex yahoo-pipes
你的:
in [item.description] replace [.+(<br>)] with [mytext]
正确:
in [item.description] replace [.+?(<br>)] with [mytext]
请参阅:Greedy vs. non-greedy matching。
另外,括号是多余的。 .+?<br> 也可以。
【讨论】:
replace [.+?<br>.+?<br>] with [nothing](或稍有变化,取决于输入),但正则表达式不是处理 HTML 的正确工具,因此不可能给出明确的答案。只能有适用于某些输入的答案。