Re: retrieving info from file

From: Sam Holden (sholden_at_flexal.cs.usyd.edu.au)
Date: 10/20/03


Date: 20 Oct 2003 01:50:45 GMT

On Sun, 19 Oct 2003 21:42:15 -0400, Peter <feurry@hotmail.com> wrote:
 
> i used the following
> $probe =~ m/\(-vop crop\=(\d+):(\d+):(\d+):(\d+)/;
> print "$1, $2, $3, $4\n";
> and it worked perfectly. Thanks a lot for your help!

if ($probe =~ m/\(-vop crop\=(\d+):(\d+):(\d+):(\d+)/) {
        print "$1, $2, $3, $4\n";
} else {
        warn "Couldn't extract data from: $_";
}

or something to that effect.

Always check if the regex matched, otherwise old values of $1, etc. will
be used and hard to find bugs will result.

Yes, always.

And you don't need to escape '=', it's just a plain old character.

-- 
Sam Holden


Relevant Pages

  • Re: A critique of cgi.escape
    ... and quotes should always be escaped. ... Making cgi.escape always escape the '"' character would not break ... and would probably fix a few bugs in existing code. ...
    (comp.lang.python)
  • Re: Sacred 2 - any reviews anywhere??
    ... Been a few patches, but still some bugs. ... Closed net has especially had some bugs (remote servers where ... they store your character info, so people can't hack their character ... From the U.S. to EU servers there is ...
    (comp.sys.ibm.pc.games.rpg)
  • [EXPL] Lucent ORiNOCO Registry Decryption
    ... WEP secret is encrypted and the algorithm was not publicly documented. ... It is possible to reverse the encryption to get the plain text WEP ... block of 5 cipher text characters. ... Every plain text character, affects two ...
    (Securiteam)
  • Endless Series of Bugs
    ... Just a few more bugs from RS's feedback system, among the thousands, ... Software's greed nad revamping of the product to gear it toward Windows ... Plain text project save fails when external item is included in rbp ...
    (comp.lang.basic.realbasic)
  • Endless Series of Bugs
    ... Just a few more bugs from RS's feedback system, among the thousands, ... Software's greed nad revamping of the product to gear it toward Windows ... Plain text project save fails when external item is included in rbp ...
    (comp.lang.basic.realbasic)