>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:


  SB> $ping_result =~ m{ .* id=(\d+) }xms;

that will match 'grid=123' or 'foo=34 noid=123' etc. the .* is allowing
anything before the id. it may work here as no field other than id ends
in 'id' but it is a poor regex. don't use *. unless you mean to grab
something or skip in the middle. you are skipping in the beginning which
happens already. the correct way to force only 'id' to be found is to
use the word boundary pattern \b in front of id. then it will be found
uniquely and no need for the .*.

also the /ms options are useless. i know you got that from PBP but i
disagree with blind use of those. there are actually times when i rely
on . NOT matching a newline and i would hate to have to remove the /s
and explain that situation.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to