Re: Getting a / when regex should produce nothing
André Warnier <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Chris Bennett wrote:
...
> $article_file = $q->param("articlefilename") || '';
ok, so suppose it is "12345.html.en"
...
> if ($article_file =~ /^([a-zA-Z0-9_-]+\.html.?\w?\w?)$/) {
> $article_file = $1;
> } else {
> $article_file = '';
> }
ok, matches, so it's still "12345.html.en"
> $article_backup_file = $article_file;
still "12345.html.en"
> $article_backup_file =~ s/\.html$/_backup.html/;
>
still "12345.html.en"
(because \.html$ did not match)