From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-24T06:00:38+09:00 Subject: Re: can't find appropriate regexp On Mon, 23 Jun 2003 22:31:03 +0200, Patrick Zesar wrote: > spamassassin blocked my previous post :-(((( > copy below: I see your previous post, me don't understand ?? > ---- start of example-lines ---- > foo "foobar"; > bar "foo" "bar"; > fob "foo \"bar\""; > ---- end of example-lines ---- > ["foobar"] > ["foo","bar"] > ["foo \"bar\""] You want to *reject* if there is an odd number of slashes and *include* if there is zero or an equal number of slashes? The best I could come up with... it doesn't work :-( inp = %Q{a "b" ."c." .."d.." ..."e..." ...."f...."} s = inp.gsub(/\./, "\\") result = s.scan(/(\\\\)*"(.*?)(\\\\)*"/) p result #=> [[nil, "b", nil], [nil, "c\\", nil], ["\\\\", "d", "\\\\"], ["\\\\", "e\\", "\\\\"], ["\\\\", "f", "\\\\"]] Is there anyone who know how to do the *reject* thing ? -- Simon Strandgaard