From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-24T07:21:06+09:00 Subject: Re: can't find appropriate regexp On Mon, 23 Jun 2003 22:25:56 +0000, ahoward wrote: > On Mon, 23 Jun 2003, Simon Strandgaard wrote: > >> Is there anyone who know how to do the *reject* thing ? > > (?!pattern) rejects. Ok.. I think I solved it.. tell me if it works ? > cat q2.rb def extract_quotes(str) tmp = str.scan(/[^\\](\\\\)*"(.*?[^\\](\\\\)*)"/) tmp.collect { |res| res[1] } end #s = %Q{a "b" ."c." .."d.." ..."e..." ...."f...."}.gsub(/\./, "\\") #p extract_quotes(s) p extract_quotes('foo "foobar";') p extract_quotes('bar "foo" "bar";') p extract_quotes('fob "foo \"bar\"";') > > ruby q2.rb ["foobar"] ["foo", "bar"] ["foo \\\"bar\\\""] > -- Simon Strandgaard