Nested quantifiers before HERE mark in regex m/(\d{4})(\d{2}{ << HERE 2})/ at line. when i do that, so that's not the answer. print join "/", ($date =~ /(\d{4})(\d{2}{2})/)[1,2,0];
> -----Original Message----- > From: Tanton Gibbs [mailto:[EMAIL PROTECTED]] > Sent: 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] > > Tanton > ----- Original Message ----- > From: "Nikola Janceski" <[EMAIL PROTECTED]> > To: "Beginners (E-mail)" <[EMAIL PROTECTED]> > 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't > > > > __END__ > > > > why did the second pattern not capture the second occurance > of \d{2} ? > > Is this the correct action? or should it capture the second > one in the > > second example? > > Is there a way to capture like so (like second example as I > expected it to > > work)? > > > > > > Nikola Janceski > > > > If you enjoy what you do, you'll never work another day in > your life. > > -- Confucius > > > > > > > -------------------------------------------------------------- > ------------ > -- > > -------------------- > > The views and opinions expressed in this email message are > the sender's > > own, and do not necessarily represent the views and > opinions of Summit > > Systems Inc. > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]