Perl regex find file extension




















I have been into Perl on and off for more than a decade and there are times when I just want some quick reference. Add a comment. Active Oldest Votes. Improve this answer. Gavin Brock Gavin Brock 4, 1 1 gold badge 28 28 silver badges 33 33 bronze badges. This is perfect. Is there a regex command to separate the two in one shot? I've never thought that File::Basename was any good for this job considering that you have to supply the pattern that you could have used with the match operator to get the same thing done.

But File::Basename parses the rest of the path as well. If OP needs to get them besides extension need, File::Basename comes in handy. Warning: I had files which users named as filename.. Prefer the one in toolic reply or the Perl Docs for File:Basename if going in this direction.

Active 2 days ago. Viewed k times. I can get all jpg images by using: find. Improve this question. Michael Mrozek Related: find -name pattern that matches multiple patterns at SO — kenorb. Add a comment. Active Oldest Votes.

Use the -o flag between different parameters. Improve this answer. Community Bot 1. Shadur Shadur Do you need the parentheses. So make that 5 conditions to meet. Another question, has anybody ever seen a file ending in ". If not, I can slop my way around that too.

That works nicely Duncan, thx. Red Flag This Post Please let us know here why this post is inappropriate. Close Box. Log In Come Join Us! Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.

How can I meet all requirements with a single regex? Article Contributed By :. Easy Normal Medium Hard Expert.

Writing code in comment? Please use ide. Load Comments. What's New. Most popular in Perl. Introduction to Perl Perl sleep Function. More related articles in Perl. We use cookies to ensure you have the best browsing experience on our website.



0コメント

  • 1000 / 1000