RE: regex capturing

2002-07-31 Thread Janek Schleicher
Bob Showalter wrote at Wed, 31 Jul 2002 21:34:02 +0200: >> > $\ = "\n"; >> > $date = "20020731"; >> > print join "/", ($date =~ /(\d{4})(\d{2})(\d{2})/)[1,2,0]; >> # this works >> > print join "/", ($date =~ /(\d{4})(\d{2}){2}/)[1,2,0]; # >> this doesn't >> > >> The second pattern matches only

RE: regex capturing

2002-07-31 Thread Bob Showalter
> -Original Message- > From: Janek Schleicher [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 31, 2002 2:14 PM > To: [EMAIL PROTECTED] > Subject: Re: regex capturing > > > Nikola Janceski wrote at Wed, 31 Jul 2002 17:27:22 +0200: > > > $\ = "

Re: regex capturing

2002-07-31 Thread Janek Schleicher
Nikola Janceski wrote at Wed, 31 Jul 2002 17:27:22 +0200: > $\ = "\n"; > $date = "20020731"; > print join "/", ($date =~ /(\d{4})(\d{2})(\d{2})/)[1,2,0]; # this works > print join "/", ($date =~ /(\d{4})(\d{2}){2}/)[1,2,0]; # this doesn't > > __END__ > > why did the second pattern not capture t

RE: regex capturing

2002-07-31 Thread Nikola Janceski
essage- > From: Bob Showalter [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 31, 2002 12:21 PM > To: 'Nikola Janceski'; Beginners (E-mail) > Subject: RE: regex capturing > > > But it does capture the second occurrence (the 31). It doesn't capture >

RE: regex capturing

2002-07-31 Thread Bob Showalter
> -Original Message- > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 31, 2002 11:27 AM > To: Beginners (E-mail) > Subject: regex capturing > > > $\ = "\n"; > $date = "20020731"; > print join "/"

RE: regex capturing

2002-07-31 Thread Nikola Janceski
Wednesday, July 31, 2002 11:55 AM > To: Nikola Janceski; Beginners (E-mail) > Subject: Re: regex capturing > > > To capture the second occurance you have to surround the {2} > with parens. > > print join "/", ($date =~ /(\d{4})(\d{2}{2})/)[1,2,0] > > T

Re: regex capturing

2002-07-31 Thread Tanton Gibbs
t; Sent: Wednesday, July 31, 2002 11:27 AM Subject: regex capturing > $\ = "\n"; > $date = "20020731"; > print join "/", ($date =~ /(\d{4})(\d{2})(\d{2})/)[1,2,0]; # this works > print join "/", ($date =~ /(\d{4})(\d{2}){2}/)[1,2,0]; # this doesn

regex capturing

2002-07-31 Thread Nikola Janceski
$\ = "\n"; $date = "20020731"; print join "/", ($date =~ /(\d{4})(\d{2})(\d{2})/)[1,2,0]; # this works print join "/", ($date =~ /(\d{4})(\d{2}){2}/)[1,2,0]; # this doesn't __END__ why did the second pattern not capture the second occurance of \d{2} ? Is this the correct action? or should it cap