"be consistent" | |
PerlMonks |
Re: Reg Expression on file nameby sauoq (Abbot) |
on Jan 06, 2003 at 19:28 UTC ( [id://224711]=note: print w/replies, xml ) | Need Help?? |
The T* part of that restricts the match to files beginning with "AB DA" followed by 0 or more T's followed by ".doc" and that's probably not what you meant. You are missing a dot. Try /^AB DAT.*\.doc$/i instead. Note that I replace the \s with a literal space. That's because \s will also match a tab or a newline. I don't know if you really want the /i modifier. That will make the expression case insensitive so it will also match files beginning with "ab dat" or "Ab DaT" and so on. You might also consider using unless rather than if ... !~ too. I'd write the whole thing as
By the way, filenames with spaces in them are yucky. If you have control over the filenames, I suggest renaming them and replacing spaces with underscores. -sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|