Regular expression in Ruby

Posted by Sainath Mallidi on Stack Overflow See other posts from Stack Overflow or by Sainath Mallidi
Published on 2010-06-03T00:56:58Z Indexed on 2010/06/03 1:04 UTC
Read the original article Hit count: 223

Filed under:
|

Hi,

Could anybody help me make a proper regular expression from a bunch of text in Ruby. I tried a lot but I don't know how to handle variable length titles.

The string will be of format <sometext>title:"<actual_title>"<sometext>. I want to extract actual_title from this string.

I tried /title:"."/ but it doesnt find any matches as it expects a closing quotation after one variable from opening quotation. I couldn't figure how to make it check for variable length of string. Any help is appreciated. Thanks.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby