[Koha-patches] Bug 3068: tighten regex for ip matching

Galen Charlton gmcharlt at gmail.com
Tue Sep 15 05:11:22 CEST 2009


Hi Ian,

On Wed, Sep 2, 2009 at 4:11 PM, Walls, Ian <Ian.Walls at med.nyu.edu> wrote:
> +                       # escape '.', and replace '*' with 1-3 digits
> +                       $domain =~ s/./\./g;

This patch needs some work.  '.' in the substitution matches any
character, so the effect of this will be to change the entire $domain
string to periods, which you can see by running the following
one-liner:

perl -e 'my $domain = 'abcdef'; $domain =~ s/./\./g; print "$domain\n";'

Do you perhaps mean:

$domain =~ s/\./\\./g;

> +                       $domain =~ s/*/\d{1-3}/g;

This won't work either, as you'll see if you try

perl -e 'my $domain = 'abcdef'; $domain =~ s/*/\d{1-3}/g; print "$domain\n"';

Regards,

Galen
-- 
Galen Charlton
gmcharlt at gmail.com



More information about the Koha-patches mailing list