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

  • Home
  • SEARCH
  • 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 901913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:38:08+00:00 2026-05-15T15:38:08+00:00

I have to parse some tables from an ASCII text file. Here’s a partial

  • 0

I have to parse some tables from an ASCII text file. Here’s a partial sample:

QSMDRYCELL   11.00   11.10   11.00   11.00    -.90      11     11000     1.212
RECKITTBEN  192.50  209.00  192.50  201.80    5.21      34      2850     5.707
RUPALIINS   150.00  159.00  150.00  156.25    6.29       4        80      .125
SALAMCRST   164.00  164.75  163.00  163.25    -.45      80      8250    13.505
SINGERBD    779.75  779.75  770.00  773.00    -.89       8        95      .735
SONARBAINS   68.00   69.00   67.50   68.00     .74      11      3050     2.077

The table consists of 1 column of text and 8 columns of floating point numbers. I’d like to capture each column via regex.

I’m pretty new to regular expressions. Here’s the faulty regex pattern I came up with:

(\S+)\s+(\s+[\d\.\-]+){8}

But the pattern captures only the first and the last columns. RegexBuddy also emits the following warning:

You repeated the capturing group
itself. The group will capture only
the last iteration. Put a capturing
group around the repeated group to
capture all iterations.

I’ve consulted their help file, but I don’t have a clue as to how to solve this.

How can I capture each column separately?

  • 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-15T15:38:09+00:00Added an answer on May 15, 2026 at 3:38 pm

    In C# (modified from this example):

    string input = "QSMDRYCELL   11.00   11.10   11.00   11.00    -.90      11     11000     1.212";
    string pattern = @"^(\S+)\s+(\s+[\d.-]+){8}$";
    Match match = Regex.Match(input, pattern, RegexOptions.MultiLine);
    if (match.Success) {
       Console.WriteLine("Matched text: {0}", match.Value);
       for (int ctr = 1; ctr < match.Groups.Count; ctr++) {
          Console.WriteLine("   Group {0}:  {1}", ctr, match.Groups[ctr].Value);
          int captureCtr = 0;
          foreach (Capture capture in match.Groups[ctr].Captures) {
             Console.WriteLine("      Capture {0}: {1}", 
                               captureCtr, capture.Value);
             captureCtr++; 
          }
       }
    }
    

    Output:

    Matched text: QSMDRYCELL   11.00   11.10   11.00   11.00    -.90      11     11000     1.212
    ...
        Group 2:      1.212
             Capture 0:  11.00
             Capture 1:    11.10
             Capture 2:    11.00
    ...etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to parse a tab-delimited text file with Ruby to extract some data
I have some HTML I am trying to parse. There are cases where the
I have one interesting problem. I must parse mail body (regular expression), get some
I have a binary file that I have to parse and I'm using Python.
I have a Deplhi based Windows Service that, on installation, parses some command line
For a small project I have to parse pdf files and take a specific
My application receives strings that represent objects. I have to parse the strings to
Is there a easy way to do this? Or do I have to parse
I have a class to parse a matrix that keeps the result in an
I have been trying to parse Java exceptions that appear in a log for

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.