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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:00:35+00:00 2026-05-20T21:00:35+00:00

Yoav – edited to be clearer Hi, I need to find 6 digit numerical

  • 0

Yoav – edited to be clearer

Hi,
I need to find 6 digit numerical strings in a text file. I’m working in C#.
Example:

text text text123365 text text text

The expression must skip strings longer then 6:

text text text1233656 text text text

The above string should not return any result because the length of the digit string is 7.

I came up with this expression: [^0-9]([0-9]){6}[^0-9]

It works perfectly with the exception of string that are at the start or end of the line

123365text text text text text text
text text text text text text123365

Is it possible to identify these cases?

  • 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-05-20T21:00:36+00:00Added an answer on May 20, 2026 at 9:00 pm

    Try:

    (?<!\d)\d{6}(?!\d)
    

    It says:

    • Find 6 digits that are not directly preceeded or succeeded with a digit

    It will look anywhere in the string.

    Examples:

    123365text text text text text text
    text text text text text text123365

    Matches:

    1. 123365
    2. 123365

    123365text text text 234098 text text text
    text text text text text 567890 text123365

    Matches:

    1. 123365
    2. 234098
    3. 567890
    4. 123365
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I upload an image file to a webservice using SOAP? I need
Is there any way to limit the input text of edittext to english and
Is it possible that in 1 listactivity will handle multiple lists? Yoav
How can I change the starts image in the android rating bar? I need
I need some help. Is there a way to use Kinect (on windows) using
I am using Gamelogic class which implements no one (just object to be honest
I'm running a multithreaded java app in Linux RedHat 5.3 on a machine that
I have a java application that I run from eclipse 3.5. My OS is
I have SQL Server on hosting, clients are mobile applications. I have logic that
I have 2 processes in my Win32 console application. 1 process - main program

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.