红宝石中的多行正则表达式

Ric*_*ton 2 ruby regex ruby-on-rails-3

我试图从我的Kindle剪辑中删除一些重复的文本,如下所示:

 The starting point,obviously,is a thorough analysis ofthe intellectual property portfolio,the contents ofwhich can be broadly divided into two categories:property that is in use and property that is not in use
 ==========
 Essentials of Licensing Intellectual Property (Alexander I. Poltorak, Paul J. Lerner)
 - Highlight on Page 25 | Added on Friday, 25 November 11 10:53:36 Greenwich Mean Time

 commentators (a euphemism for prolific writers with little experience
 ==========
 Essentials of Licensing Intellectual Property (Alexander I. Poltorak, Paul J. Lerner)
 - Highlight on Page 26 | Added on Friday, 25 November 11 10:54:29 Greenwich Mean Time
Run Code Online (Sandbox Code Playgroud)

我试图消除"Essentials"和"Time"之间的关系.我正在玩的regexp现在看起来像这样:

Essentials([^,]+)Time
Run Code Online (Sandbox Code Playgroud)

但显然它不起作用:

http://rubular.com/r/gwSJFgOQai

任何帮助这个nuby将非常感谢!

Mar*_*mas 6

你需要/ m修饰符使.匹配换行:

/Essentials(.*?)Time/m
Run Code Online (Sandbox Code Playgroud)

看到它在这里工作:http: //rubular.com/r/qgmkWnLzW6