【发布时间】:2015-09-21 22:44:49
【问题描述】:
如何使用正则表达式匹配开始标签和空行或结束标签之间的内容?
<START> some text is here.
more text
unrelated text
<START> even more text.
text text
<STOP>
它应该匹配两个匹配项
<START> some text is here.
more text
和
<START> even more text.
text text
<STOP>
到目前为止我提出的正则表达式如下(但它匹配整个文本,我假设是因为 (?s).* 部分)。
<START>((?s).*)(\s\s|<STOP>)
【问题讨论】:
标签: regex