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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:10:10+00:00 2026-06-01T23:10:10+00:00

C#/.NET 4.0 I need to parse a string containing a 18-digit number. I also

  • 0

C#/.NET 4.0

I need to parse a string containing a 18-digit number. I also need the substrings at the left and right side.
Example strings:

string a = "Frl Camp Gerbesklooster 871687120000000691 OPLDN 2010 H1";
string b = "some text with spaces 123456789012345678 more text";

How it should be parsed:

string aParsed[0] = "Frl Camp Gerbesklooster";
string aParsed[1] = "871687120000000691";
string aParsed[2] = "OPLDN 2010 H1";

string bParsed[0] = "some text with spaces";
string bParsed[1] = "123456789012345678";
string bParsed[2] = "more text";

There is always that 18-digit number in the middle of the string. I’m an absolute newbie to Regex so I don’t actually have a try of my own.
What is the best way to do this? Should I use regular expressions?
Thanks.

  • 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-01T23:10:11+00:00Added an answer on June 1, 2026 at 11:10 pm

    You can use something like the regex: (.*)(\d{18})(.*).

    The key here is to use {18} to specify that there must be exactly 18 digits and to capture each part in a group.

    var parts = Regex.Matches(s, @"(.*)(\d{18})(.*)")
        .Cast<Match>()
        .SelectMany(m => m.Groups.Cast<Group>().Skip(1).Select(g=>g.Value))
        .ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I retrieve mail using net/pop , but I also need to parse through the
I need to a parse an xml string(.NET, C#) which , unfortunately, is not
I need to parse and separate input strings using VB.NET. Split method works in
Is there any way to parse a string in vb.net (like, built in methods),
The custom date strings in .NET allow you to parse a date with seven
Is it possible in ASP.NET to take a string containing some HTML and make
For a one-shot operation, i need to parse the contents of an XML string
Ok right now I have an object containing 3 strings, along with setters and
Basically, I'm looking for .NET's BitConverter . I need to get bytes from String,
I have a need to parse Bezier Path Strings, but apparently the System.Windows.Media.Geometry version

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.