From: Robert Dober Date: 2006-05-25T04:43:13+09:00 Subject: Re: RegExp Problem ------=_Part_179583_17592623.1148499790716 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 5/24/06, A LeDonne wrote: > > On 5/24/06, John W. Long wrote: > > That makes perfect sense. So how do I get it to do what I want? > > > > -- > > John Long > > http://wiseheartdesign.com > > http://radiantcms.org > > Umm.... backwards? > > irb(main):001:0> re =3D /!(['"]).*?\1/ > =3D> /!(['"]).*?\1/ > irb(main):002:0> fun =3D %{ "this looks like "fun"!" } > =3D> " \"this looks like \"fun\"!\" " > irb(main):003:0> md =3D re.match fun.reverse > =3D> # > irb(main):004:0> md[0].reverse > =3D> "\"fun\"!" > > This way, instead of trying to negate a character class, you're just > doing a non-greedy match from the anchored exclamation point - quote > mark combo to the first matching quote mark. I do not know if this is a performance killer (probably not ) but frankly I do not care, this is one of the most original ideas I have ever seen on thi= s list. Just wanted to say this! Really nice! Robert P.S. It was yours was it not? ;) R -A > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_179583_17592623.1148499790716--