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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:15:34+00:00 2026-05-10T16:15:34+00:00

I am parsing text that has a heading and then data that applies to

  • 0

I am parsing text that has a heading and then data that applies to that heading. I need to break each data field into groups, and have the heading also apply to those groups. Here’s an example:

(Update: The text below has been updated to better reflect it’s current layout, and to indicate an annotation.)

 Heading 1 Heading 2      Heading 3 (Group 1) data1 data2  data3 data4  data5  (Group 2) data1 data2  data3 data4  data5 (Group 3)  data1 data2  data3 data4 data5 ** The headers become different values here *** (this is not part of the data) NewHeading 1 NewHeading 2      NewHeading 3 (Group 4) data1 data2  data3 data4  data5  (Group 5) data1 data2  data3 data4  data5 **etc 

The output should be like this:

 (Group 1) Heading1 Heading2 Heading3 data1 data2 data3 data4 data5 (Group 2) Heading1 Heading2 Heading3 data1 data2 data3 data4 data5 (Group 3) Heading1 Heading2 Heading3 data1 data2 data3 data4 data5 (Group 4) NewHeading1 NewHeading2 NewHeading3 data1 data2 data3 data4 data5 (Group 5) NewHeading1 NewHeading2 NewHeading3 data1 data2 data3 data4 data5 

The fields marked (Group 1-5) are just labels for the line, they are not meant to be part of the returned set. The Headings changing to ‘NewHeading’ is merely to indicate that the header values have changed and should be applied to the data that follows it.

I’ve done a bit of reading over the past couple of hours looking for what this is called, but I haven’t had any luck. Any ideas? This is for the .Net regex engine.

Update: Annotations added, and showed that the headers change over the file. I have also done some research and believe I can accomplish something almost as easy by having two patterns. One for the headers, and one for the data. Then I can compare the header and data match index (ie: where it is found in the file) to each other and combine them that way.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-10T16:15:34+00:00Added an answer on May 10, 2026 at 4:15 pm

    1) Loop through line by line. This isn’t the place for a regex

    2) You really need to clarify your question. It isn’t clear if (Group 1) and ** The headings become different here ** are part of your input, or whether you’re annotating it.

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

Sidebar

Related Questions

I have a text file that I parse each month and insert the data
I have several entity classes that I use for parsing fixed width text files
I have a script that takes an uploaded text file, parses it and then
I have some parsing code that allows for escape sequences to be entered into
I'm parsing a document that has a known repeating structure. There is a heading
I'm parsing an xml file, that has nodes with text like this: <img src=someUrl1>
I'm parsing a text file which has data in it. Whenever is a text
I am parsing data from this XML url The text input varies, depending on
I have a simple text that is being parsed with PHP. In that text,
I need to generate windows form fields based off of a text file that

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.