From: MOUBAMBA Laury karin Date: 2009-02-08T18:20:24+09:00 Subject: Re : cannot remove multiple space> nuts! --0-215951147-1234084876=:72704 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable how to unsubscribe to this email list ?=0A=0A=0A=0A=0A_____________________= ___________=0ADe : Tom Cloyd =0A=C3=80 : ruby-talk ML= =0AEnvoy=C3=A9 le : Samedi, 7 F=C3=A9vrier 2009, = 22h48mn 08s=0AObjet=C2=A0: Re: cannot remove multiple space> nuts!=0A=0ARob= ert Klemme wrote:=0A> On 07.02.2009 21:50, Tom Cloyd wrote:=0A>> That's bea= utifully economical, and reveals a far better grasp of regex than I was abl= e to attain last night. However, I'm having trouble with this line:=0A>> = =0A>> data.gsub!(/<(h[1-6])>/, "\\1. ")=0A>> =0A>> It certain works, but I = don't grasp the "\\1. " part. I haven't yet found anything that might shed = light on this magic. How does it retain the 'h' and whatever digit follows = it? It looks somehow like "\\" =3D=3D retain matched alpha, and the "1" doe= s the same for matched digits, but I really haven't a clue. Can you elucida= te just a bit?=0A> =0A> The keyword is "capturing groups".=C2=A0 Brackets i= n the regexp denote groups of characters which can be referenced later via = their numeric index as you have seen.=C2=A0 You can even use them for match= ing repetitions=0A> =0A> /(fo+)\1/ =3D~ s # will match "fofo", "foofoo", "f= ooofooo" etc.=0A> =0A> Cheers=0A> =0A>=C2=A0 =C2=A0 robert=0A> =0A> =0ADavi= d, badboy, Robert - thats to you all for the very clear explanations. I rea= lly couldn't find info. about this (yet). It IS clear, once the explanation= 's in had. I have to say that regex's becoming rather fun, now that I'm get= ting a little control of it.=0A=0AI continue to be amazed at the generosity= of this list in helping the real amateurs here move things along. We get t= hat AND we get to listen in on all sorts of amazing and mysterious discussi= ons of higher order magic. Pretty cool.=0A=0At.=0A=0A-- =0A~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=0ATom Cloyd, MS MA, LMHC - Privat= e practice Psychotherapist=0ABellingham, Washington, U.S.A: (360) 920-1226= =0A<< tc@tomcloyd.com >> (email)=0A<< TomCloyd.com >> (website) << sleightm= ind.wordpress.com >> (mental health weblog)=0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~=0A=0A=0A ________________________________= __________________________________________________________________=0ANe ple= urez pas si votre Webmail ferme ! R=C3=A9cup=C3=A9rez votre historique sur = Yahoo! Mail ! http://fr.docs.yahoo.com/mail/transfert_mails.html --0-215951147-1234084876=:72704--