开发者

Regex help matching 5 lines

I'm looking for some help from a regex guru, here's what I want to be able to match and remove using ruby/rails:

-----Original Message-----
From: STATIC on behalf of STATIC
Sent: Thu 11/25/2010 11:17 AM
To: Random, Random
Subject: Ra开发者_StackOverflow社区ndom replied to the comment

is it possible with regex to match these 5 lines with one Regex? Here's what I've been trying, without luck:

gsub(/-----Original Message-----/n.* From.*/n Sent.*/n To.*/n Subject.*/, '')

Thanks for the help


You need to reverse the slashes for the newlines and remove the extra space after each newline.

-----Original Message-----\n.*From.*\nSent.*\nTo.*\nSubject.*

http://rubular.com/r/z9NwUT7FWJ

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜