From: D T Date: 2003-06-24T05:36:17+09:00 Subject: Re: can't find appropriate regexp --0-836433923-1056400575=:2767 Content-Type: text/plain; charset=us-ascii Take a look about String.scan, be careful the grouping. Here is my suggestion ( I am sure someone will have better solution), but at least, it works. Example: str = < wrote: i thought about something like: /"([^"]|\\")+"/ --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! --0-836433923-1056400575=:2767 Content-Type: text/html; charset=us-ascii
Take a look about String.scan, be careful the grouping.
Here is my suggestion ( I am sure someone will have better solution), but at least, it works.
 
Example:
 
str = <<EOF
foo "foobar"
bar "foo" "bar";
fob "foo \"bar\"";
EOF
 
str.each_line{ |line|
  p line.scan(/"(?:[^"]|\\")+"/).collect! {|e| e.sub!(/^"(.*)"$/, '\1')}
}
The first regexp, take out the grouping by using (?: ... )
The sub! take out the begin and end quote.
 
Dave

Patrick Zesar <jonnypichler@gmx.net> wrote:

i thought about something like: /"([^"]|\\")+"/



Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month! --0-836433923-1056400575=:2767--