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 7965263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:06:08+00:00 2026-06-04T06:06:08+00:00

I am to find lines in a file whose fifth character is a digit.

  • 0

I am to find lines in a file whose fifth character is a digit. That is, of the digit set {0123456789}. I made a file that had:

asdf1
asdf2

.. and so on until 0.
I made a few more cases with special characters, and other symbols just to make sure I wasn’t grabbing those lines either.

However, one thing intrigued me. When making the line:

SSSSS3

or

TTTTTS7

that is, where every S is a space, and T is a tab, that line is also retrieved when the fifth character is a space/tab and not a number.

Could anybody explain why this is happening?
The pattern I’m using is

'....[0-9](.)*'

If I’m not mistaken, a ‘.’ represents any character, right? How could more than 4 tabs or spaces count as less than 5 ‘.’?

  • 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-04T06:06:10+00:00Added an answer on June 4, 2026 at 6:06 am

    You’re missing the start-of-line anchor:

    ^....[0-9]
    

    Without it, egrep performs a regexp search rather than a regexp match, as if you had entered

    .*....[0-9]
    

    though with the difference that the .* does not cause capturing for flags like -o.

    (Note that the (.)* at the end is also useless. .* is implicitly appended to the end of the RE unless you put in an end-of-line anchor, $.)

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

Sidebar

Related Questions

I'm looking for a small code snippet that will find a line in file
I often find myself with a file that has one number per line. I
How can I use the autoloader to find the class file 'templater' that lives
I am trying to loop through each line in a file and find and
I'm looking for a regex to search my python program to find all lines
I'm looking to find something along the lines of Checkstyle for Visual Studio. I've
Edit: Read the lines in bold to find where I'm having problems. I changed
Where can I find an efficient algorithm for breaking lines of text for formatted
I have been trying to find out why the following lines of code do
I find the documents frustrating. What are the basic lines I need to add

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.