正则表达式,限制匹配数量/停止匹配的东西在这里?

时间:2013-09-09 03:33:36

标签: regex

我试图从文本文件中提取一些信息。我能够匹配我需要的,问题是有太多的比赛。

信息在文中重复了几次。重复之间有独特的文本,但我无法弄清楚如何让它在遇到这个文本时停止匹配。在我的前瞻之后放置任何东西似乎打破了正则表达式。

希望有一种方法可以做到这一点,并且失败了,这是一种限制它将获得的匹配量的方法。

以下是我现在所拥有的以及我正在搜索的样本:

                  (?<=anniversary\s|\s<plaintext>).+(?=\s+)



<subpod title=''>
   <plaintext>birth of Gustav Schäfer (1988- ): 25th anniversary
birth of Arrelious Benn (1988- ): 25th anniversary
birth of Brad Silberling (1963- ): 50th anniversary
birth of Robert Lavette (1963- ): 50th anniversary
Harvard University founded (1636): 377th anniversary
Germany joins the League of nations (1926): 87th anniversary
first Miss America crowned (1921): 92nd anniversary
&quot;Blondie&quot; is first published (1930): 83rd anniversary
Galveston Hurricane of 1900 (1900): 113th anniversary
USAir Flight 427 crashes (1994): 19th anniversary</plaintext>
   <img src='http://www4b.wolframalpha.com/Calculate/MSP/MSP18771b2386h4e5i137b400002gg7ehc7hh7c2h17?MSPStoreType=image/gif&amp;s=40'
       alt='birth of Gustav Schäfer (1988- ): 25th anniversary
birth of Arrelious Benn (1988- ): 25th anniversary
birth of Brad Silberling (1963- ): 50th anniversary
birth of Robert Lavette (1963- ): 50th anniversary
Harvard University founded (1636): 377th anniversary
Germany joins the League of nations (1926): 87th anniversary

任何帮助表示赞赏

0 个答案:

没有答案