From: Zach Dennis Date: 2004-01-20T06:55:49+09:00 Subject: Re: regex help Chris, You want to take all asterik's with a following forward slash that are not inside of a double-quote? Zach P.S. - if String s = "hello*\"world*\ then you would want to capture the last *\ ? or would you like to convert the last *\ to a */ ? I guess I'm not exaxctly following what you are attempting to do. -----Original Message----- From: Chris Morris [mailto:chrismo@clabs.org] Sent: Monday, January 19, 2004 4:44 PM To: ruby-talk ML Subject: Re: regex help Simon Strandgaard wrote: >On Tue, 20 Jan 2004 04:38:12 +0900, Chris Morris wrote: > > > >>I need a re such that: >> >> ' /* comment */ String s = "***/"; '.gsub(re, "*\\") >> >>returns: >> >> ' /* comment *\ String s = "***/"; ' >> >>I want to find all *\ instances that are not enclosed in double-quotes. >>Or is this one of those problems ill-suited for a regex? >> >> > > >possible.. but difficult. > >I spend this evening making some _broken_ experiments. > > I thought it might be. I've fallen back and written a simple char-by-char parser that ignores pieces inside quotes. -- Chris http://clabs.org