K
Ken Sington
Not what I had expected.
I was hoping
/\/.*[^.].*$/
would find a "/" and does not contain any number of dots between any
number of characters.
A shash followed by any number of word characters is valid.
A shash followed by any number of word characters then a trailling slash
is valid.
A shash followed by any number of word characters then a dot then some
more chars is not valid.
If it has a dot between the final shash and end of string, it's not valid.
Here I expected a slash, anychar, must not have '.', anychar, $anchor
my $str = "/tmp/helloworld";
$str =~ /\/.*[^.].*$/
unless perl sees it as slash, anychar all the way to the end, so ignores
the rest of the regex.
other examples:
$str = "/tmp/hello"; <--- yes
$str = "/var/http-docs/cgi-bin/"; <--- yes
$str = "/var/http-docs/cgi-bin"; <--- yes
$str = "/var/http-docs/cgi-bin/hello.pl"; <--- no
$str = "/var/http-docs/cgi-bin/.blah"; <--- no
I was hoping
/\/.*[^.].*$/
would find a "/" and does not contain any number of dots between any
number of characters.
A shash followed by any number of word characters is valid.
A shash followed by any number of word characters then a trailling slash
is valid.
A shash followed by any number of word characters then a dot then some
more chars is not valid.
If it has a dot between the final shash and end of string, it's not valid.
Here I expected a slash, anychar, must not have '.', anychar, $anchor
my $str = "/tmp/helloworld";
$str =~ /\/.*[^.].*$/
unless perl sees it as slash, anychar all the way to the end, so ignores
the rest of the regex.
other examples:
$str = "/tmp/hello"; <--- yes
$str = "/var/http-docs/cgi-bin/"; <--- yes
$str = "/var/http-docs/cgi-bin"; <--- yes
$str = "/var/http-docs/cgi-bin/hello.pl"; <--- no
$str = "/var/http-docs/cgi-bin/.blah"; <--- no