RE: regular expression match question

2005-07-29 Thread Pine Yan
No more questions. :D Sincerely Pine -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: regular expression match question

2005-07-29 Thread Jeff 'japhy' Pinyan
On Jul 29, Pine Yan said: line3: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& = $&\n" if($string3 =~ /(a|b)*/); line4: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& = $&\n" if($string4 =~ //); $1 = a @{0,2}, $& = ba $1 = @{0,0}, $& = I'll go over it again

RE: regular expression match question

2005-07-29 Thread Pine Yan
-Original Message- From: Tom Allison [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 3:23 PM To: beginners@perl.org Subject: Re: regular expression match question Pine Yan wrote: > A script like this: > > line1: $string3 = "bacdeabcdefghijklabcdeabcdefghij

RE: regular expression match question

2005-07-29 Thread Pine Yan
> >The regex /[ab]*/ on the string "bad" matches 'ba' because regexes are >greedy by default. They want to match as MUCH as they can. > >BUT regexes also try to find the earliest match in the string. This is >why /[ab]*/ on the string "cab" matches ''. Because the engine found a >successful m

Re: regular expression match question

2005-07-29 Thread Tom Allison
Pine Yan wrote: A script like this: line1: $string3 = "bacdeabcdefghijklabcdeabcdefghijkl"; line2: $string4 = "xxyyzzbatttvv"; line3: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& = $&\n" if($string3 =~ /(a|b)*/); line4: print "\$1 = $1 [EMAIL PROTECTED],$+[

RE: regular expression match question

2005-07-29 Thread Jeff 'japhy' Pinyan
On Jul 29, Pine Yan said: line1: $string3 = "bacdeabcdefghijklabcdeabcdefghijkl"; line2: $string4 = "xxyyzzbatttvv"; If the regexp says "match zero or more of (a or b)", why can't we match an empty string in the first place? What causes "(a|b)*" to make no difference from "(a

RE: regular expression match question

2005-07-29 Thread Pine Yan
>> line1: $string3 = "bacdeabcdefghijklabcdeabcdefghijkl"; >> line2: $string4 = "xxyyzzbatttvv"; >> >> line3: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& = $&\n" >> if($string3 >> =~ /(a|b)*/); >> line4: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& = $&\n" >> if($stri

Re: regular expression match question

2005-07-29 Thread Jeff 'japhy' Pinyan
On Jul 29, Pine Yan said: line1: $string3 = "bacdeabcdefghijklabcdeabcdefghijkl"; line2: $string4 = "xxyyzzbatttvv"; line3: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& = $&\n" if($string3 =~ /(a|b)*/); line4: print "\$1 = $1 [EMAIL PROTECTED],$+[0]}, \$& =