Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:46:22+00:00 2026-06-05T13:46:22+00:00

I am getting files like .log and _log in a folder ,i am able

  • 0

I am getting files like .log and _log in a folder ,i am able to pick .log files with /*.log$/ but unable to find files which are _log .

need a regex pattern which will take both type of files from a specified folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:46:24+00:00Added an answer on June 5, 2026 at 1:46 pm

    Your question is tagged both ‘perl’ and ‘linux’. I’ll assume here that you’re talking about Perl style regular expressions, as it looks like that’s what you are showing in your example snippet.

    The *. sequence is a mistake.

    Let’s focus on what you want to match. You want to match any filename that ends in a dot followed by the literal characters ‘log’. You also want to match any filename that ends in an underscore, followed by the literal characters ‘log’. You really shouldn’t concern yourself with the “anything at all” that can come before the final dot or underscore. So the regexp would probably be better written as this:

    /[._]log$/
    

    Notice we don’t even bother with the dot-star. It isn’t helpful in this situation.

    If you want for your pattern to also match files where the literal characters ‘log’ may optionally be followed by an integer sequence (not mentioned in your question, but discussed in one of your followup comments), you could write it like this:

    /[._]log\d*$/
    

    Here the ‘star’ is helpful; it allows for zero or more digits sandwiched between the ‘g’ and the end of the string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have few jar files which I am not getting from any repositories.I have
What are some options for getting really fast 'Find in Files' searching in VIM?
I love Django but getting static files served in development is painfully flakey. I
I'm having an issue getting files loaded into an app called GCS, by dragging
Every example I see seems to be for recursively getting files in subdirectories uses
I am getting problem to read pdf files using iText in java. I can
I am getting started with using MEX files for MATLAB (R2012a) compiled from C
I am getting tired of manually installing javax jar files in Maven and would
I am getting this error when I am trying push my files into heroku
Now days I am getting a problem in attaching JAR files in Blackberry..... I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.