regex - using regular expressions in ruby to find a string in quotations -


I'm trying to create a regex to find a string in Ruby

  Str = "Foo"  

I want to stop trying to find the string when it gets the closing quotation mark. I also want to put quotation marks so that I can produce that string like:

  puts "string is:" + str = & gt; The string is: "foo"  

I'm very new to using regular expressions.

Here's the beginning:

  / ". *?" Explanation: 

 "Match a literal double quote. * * Match any letter, as much as possible (non-greedy)" second word Match the double quote 

Note that this will not work if the string is hidden citations or cited with single quotes.


Comments