in reply to perl regular expression
Now that code tags have been added to your node so that the code is clear, the problem also is clear. You are using [] in the regex which means match any of the characters within the square brackets. The fix is almost easy - use a non-capture group ((?:...)):
if ($filename =~ /(\.(?:htm|html|txt|pdf|ppt|csv|doc]))\b/i)
Note that the repeat ({3,4}) is not needed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl regular expression
by reasonablekeith (Deacon) on Oct 03, 2006 at 14:45 UTC | |
by chargrill (Parson) on Oct 03, 2006 at 18:15 UTC |