Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Faced with Null/blank/empty value

by jsprat (Curate)
on Jul 22, 2003 at 08:58 UTC ( #276662=note: print w/replies, xml ) Need Help??


in reply to Re: Faced with Null/blank/empty value
in thread Faced with Null/blank/empty value

Good idea - especially if it is in a loop. Instead of all three regexes every time, it'll do a maximum of 3.

In order to get the same results, however, the three regexes need to be reversed. In bh_perl's example, when the first match and the last match succeeded, $1 and $2 are set in the third match. In your example, if the first match succeeds the third is never evaluated so $1 and $2 are set by the first match. Reverse the three matches and the results will match the OP's.

  • Comment on Re: Re: Faced with Null/blank/empty value

Replies are listed 'Best First'.
Re: Faced with Null/blank/empty value
by cLive ;-) (Prior) on Jul 22, 2003 at 09:07 UTC
    I assumed that only one match was required and that bh_perl was just a little inexperienced here in coding that idea. If you look, the 3 regular expressions are exclusive - ie, if one matches, the other two won't.

    cLive ;-)

      If you look, the 3 regular expressions are exclusive - ie, if one matches, the other two won't.

      Ahhh, good point. I didn't look at the regexes closely enough.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://276662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2020-05-25 00:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (142 votes). Check out past polls.

    Notices?