5

Regular Expression to match files in Perl

view full story
linux-howto

http://www.unix.com – Hi Everybody! I need some help with a regular expression in Perl that will match files named messages, but also files named message.1, message.2 and so on. So really I need one that will find messages and messages that might be followed by a period and a digit without matching other files like messages.txt. Here is the regular expression that I have come up with: Code: if($file =~ /messages[.][0-9]/) Using the regular expression above I am able to match the messages.1, message.2 files, but it will not pick up messages without the period and digit on the end. O'Reilly School Of (HowTos)