[boulder.pm] RegExpn Matching, not
Scott Longmore
longmore at fsl.noaa.gov
Wed Feb 9 16:39:25 CST 2000
> Ok,
> I'm screwing around with my own Web Page generator for some comics I
> like. Really an excuse to mess with LWP and some RegExpressions. I have
>
> The following lines:
>
>
> Defined when reading a config file:
> $ComicsMatch{userfriendly}= cartoons\/archives\/\w*\/\w*.gif;
>
>
> In the Main script:
>
> This Works perfectly
> $content =~ /(cartoons\/archives\/\w*\/\w*.gif)/;
>
> Does Not Work:
> $content =~ /($ComicsMatch{$key})/;
>
> Does Not Work:
> $TmpMUrl=$ComicsMatch{$key};
> $content =~ /($TmpMUrl)/;
>
>
> I really need to user iteration #2, or #3 so I can keep a config file
> instead of hardwiring into the script itself.
>
>
> Robert
Robert,
You need single quotes around your regular expression during
assignment or it will be evaluated during assignment..i.e.:
$ComicsMatch{userfriendly}='cartoons\/archives\/\w*\/\w*.gif';
This has burned me several times...especially when reading regexps
from configuration files. One of those little interpreted vs compiled
language things.
Regards,
Scott
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Scott Longmore - CIRA Research Associate \\\\\\\\\\\\ | ~
~ DOC\NOAA\OAR\FSL\MD\E-Team & FSL\RRV Project \\\\\\\\\ - * - ~
~ 325 Broadway R/FS6, 2C311 DSRC ~\__n__\ | ~
~ Boulder, CO 80303 USA \\\\\\\ ~
~ E-mail: longmore at fsl.noaa.gov \MMMM\ ~
~ URL: http://www-md.fsl.noaa.gov/~longmore \\\\\ ~
~ Phone: (303) 497-6443 Fax: (303) 497-3096 \\\\\Dust\Devil/~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the immortal words of Socrates..."I drank what?" -Chris Knight-
More information about the Boulder-pm
mailing list