Reputation: 527
I want a perl regular expression which will print the files name those have only .txt extension at the end nothing else.
I have written a reg exp but it is printing all the files with extension .txt also .txt* files. That I dont want
if($filename=~m/xxx\\.txt/i)
I have now also tried the following, but it is also not working
if($filename=~m/xxx\\.txt$/i)
Upvotes: 0
Views: 105
Reputation: 300
Would it be that Windows is adding funny things at end of file names? Try:
if($filename =~ /\.txt\s*/)
Upvotes: 0