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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:04:45+00:00 2026-05-28T15:04:45+00:00

I am parsing an excel document and one column includes n number of serial

  • 0

I am parsing an excel document and one column includes n number of serial numbers for each row, separated by a white space.

sample serials: 1108656 1108657 1108658 1108659 1108660 1108661 1108662 1108663 1108664 1108665 1108666

how could I use regex to analyze that string and return a List or IEnumerable where each serial number in the sample is an individual element?

serials are between 5 and 8 numbers long.

I am using C# and the .Net Regex.

  • 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-28T15:04:46+00:00Added an answer on May 28, 2026 at 3:04 pm

    If the string is simply numbers separated by spaces I’d suggest going with String.Split method like this :

    string[] mySerialNumbers = searchString.Split(new char[]{' '});
    

    See the documentation of String.Split.

    To have the result as an IEnumerable you can simply create a List<string> with the result of String.Split like this :

    List<string> mySerialNumbers = new List<string>(searchString.Split(new char[]{' '});
    

    Edit:

    After reading the comment, the Regex way would indeed kind of validate the input to make sure no other characters are there, which is a good thing. The regex for this would be as simple as this :

    foreach(Match match in Regex.Matches("1108656 1108657 1108658 1108659", "[0-9]{5,8}"))
    {
        // Do something with match.Value here like : int.Parse(match.Value)
    }
    

    The regex expression [0-9]{5,8} means any digit repeated between 5 and 8 times. Of course this Regex is really simple and will simply capture the good things. For example as tring with 1234567 abcd 7654321 will not give any error, it will simply capture the 2 numbers and silently ignore the letters. You could make a much more complex regex to validate even better. This could be a solid starting reference for regex : http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet

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

Sidebar

Related Questions

I would like to parse a cell column of strings in Excel VBA, each
for example, we have two classes for parsing the resumes, one to parse Excel
I am parsing an Excel file and am having difficulty reading in the value
I am parsing through an uploaded excel files (xlsx) in asp.net with c#. I
I'm building an app with some extension parsing functionality mainly with excel files. I
We have an Excel file with a worksheet containing people records. 1. Phone Number
Which is better API for excel parsing in Java Apache POI or JExcel API?
I have an XML Document and I need to convert it into an Excel
I'm doing some webpage parsing in VBA within Excel; I'm MSHTML to download and
I am parsing data from an excel file and adding it to my data

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.