regex question

L. Adrian Griffis adrian at nerds.org
Mon Jul 7 17:41:25 CDT 2003


On Mon, 7 Jul 2003, Jason Crowe wrote:
> Gene Dascher wrote:
> > I always escape all non-alphanum characters (i.e., < ).  Also, your 
> > code won't place the found value in $content, it checks the
> > value of $content to match the regex.  You need to do something like 
> > this:
> >
> >
> > if ($content ~= m/Current 
> > bid:n</font>n</td>n.+n<.+$([0-9.,]+)</) {
> >     $content = $1;
> > }
> >
> > I just tested this and it works fine.
> 
> It doesn't seem to work for me. For the most part it's the same as what 
> I had. Here is more of the script to show what I am starting with. The 
> currently variable is never getting set.
> 
> if($ARGV[0]) {
>  $content = 
> get("http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=$ARGV[0]");
>  $content =~ s/r//g;
>  if($content ~= m/Current 
> bid:n</font>n</td>n.+n<.+$([0-9.,]+)</) {
>    $currently = $1;
>    $currently =~ s/,//g;
>  }

I thought there was something you had to do to tell PERL that you
want to be able to use "n" in the middle of a regular expression.
I don't remember what it was, but I think it involved setting a value
in one of the special variables.

Adrian




More information about the Kclug mailing list