From: Phrogz Date: 2007-03-06T09:20:10+09:00 Subject: Re: Regular expressions - Again On Mar 5, 5:00 pm, "J. mp" wrote: > Now, if I have a String like > "some string some content this I want" > > And I want to use the scan function to extract what is between > and how can I build my regular expression. The final result > should be: > this I want irb(main):001:0> str = "This is what I irb(main):002:0" want and no more" => "This is what I\nwant and no more" irb(main):003:0> str[ %r{(.+?)}, 1 ] => nil irb(main):004:0> str[ %r{(.+?)}m, 1 ] => "what I\nwant" Note that the use of 'm' to match across multiple lines, assuming your title tag spans them. Note that this will fail if you have "This is <title>nested</ title> content", and will result in "This is nested"