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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:20:26+00:00 2026-05-16T06:20:26+00:00

I have data in an html file, in a table: <table> <tr><td>001</td><td>MC Hammer</td><td>Can’t Touch

  • 0

I have data in an html file, in a table:

<table>
    <tr><td>001</td><td>MC Hammer</td><td>Can't Touch This</td></tr>
    <tr><td>002</td><td>Tone Loc</td><td>Funky Cold Medina</td></tr>
    <tr><td>003</td><td>Funkdoobiest</td><td>Bow Wow Wow</td></tr>
</table>

How do I split a single row into an array or list?

string row = streamReader.ReadLine();

List<string> data = row.Split //... how do I do this bit?

string artist = data[1];
  • 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-16T06:20:26+00:00Added an answer on May 16, 2026 at 6:20 am

    Short answer: never try to parse HTML from the wild with regular expressions. It will most likely come back to haunt you.

    Longer answer: As long as you can absolutely, positively guarantee that the HTML that you are parsing fits the given structure, you can use string.Split() as Jenni suggested.

    string html = "<tr><td>001</td><td>MC Hammer</td><td>Can't Touch This</td></tr>";
    
    string[] values = html.Split(new string[] { "<tr>","</tr>","<td>","</td>" }, StringSplitOptions.RemoveEmptyEntries);
    
    List<string> list = new List<string>(values);
    

    Listing the tags independently keeps this slightly more readable, and the .RemoveEmptyEntries will keep you from getting an empty string in your list between adjacent closing and opening tags.

    If this HTML is coming from the wild, or from a tool that may change – in other words, if this is more than a one-off transaction – I strongly encourage you to use something like the HTML Agility Pack instead. It’s pretty easy to integrate, and there are lots of examples on the Intarwebs.

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

Sidebar

Related Questions

I have an HTML (App) file that reads another HTML (data) file via jQuery.ajax()
I have written an Excel VBA macro which imports data from a HTML file
First I have a PHP file that gets data and file from a HTML
I have table rows of data in html being filled from a CGI application.
I have an html table which i bind data dynamically on the server side
I have a html form with the data by this post method 'form id='form1'
I have a table with one row in my HTML file. Now in jQuery
I have a simple HTML input file; which contains a table. The column headers
I have a php file that receives data from mySQL table. The mySQL table
I have to return data fetched from MySQL table into a php file as

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.