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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:11:38+00:00 2026-06-05T19:11:38+00:00

So, say I’m parsing the following HTML string: <html> <head> RANDOM JAVASCRIPT AND CSS

  • 0

So, say I’m parsing the following HTML string:

<html>
    <head>
        RANDOM JAVASCRIPT AND CSS AHHHHHH!!!!!!!!
    </head>
    <body>
        <table class="table">
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
            <tr><a href="/subdir/members/Name">Name</a></tr>
        </table>
    <body>
</html>

and I want to isolate the contents of ** (everything inside of the table class)

Now, I used regex to accomplish this:

string pagesource = (method that extracts the html source and stores it into a string);
string[] splitSource = Regex.Split(pagesource, "<table class=/"member/">;
string memberList = Regex.Split(splitSource[1], "</table>");
//the list of table members will be in memberList[0];
//method to extract links from the table
ExtractLinks(memberList[0]);

I’ve been looking at other ways to do this extraction, and I came across the Match object in C#.

I’m attempting to do something like this:

Match match = Regex.Match(pageSource, "<table class=\"members\">(.|\n)*?</table>");

The purpose of the above was to hopefully extract a match value between the two delimiters, but, when I try to run it the match value is:

match.value = </table>

MY question, as such, is: is there a way to extract data from my string that is slightly easier/more readable/shorter than my method using regex? For this simple example, regex is fine, but for more complex examples, I find myself with the coding equivalent of scribbles all over my screen.

I would really like to use match, because it seems like a very neat and tidy class, but I can’t seem to get it working for my needs. Can anyone help me with this?

Thank you very much!

  • 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-05T19:11:39+00:00Added an answer on June 5, 2026 at 7:11 pm

    Use an HTML parser, like HTML Agility Pack.

    var doc = new HtmlDocument();
    
    using (var wc = new WebClient())
    using (var stream = wc.OpenRead(url))
    {
        doc.Load(stream);
    }
    
    var table = doc.DocumentElement.Element("html").Element("body").Element("table");
    string tableHtml = table.OuterHtml;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have this html: <table> <tr> <th>Sort Order</th> <th>Name</th> </tr> <tr class=item id=item_1>
Say I have 2 div s with the same CSS class that are stacked
Say I have the following template function: template <class T> void apply(const vector<complex<T> >&
Say I have the following: class Base { public Base (int n) { }
Say I have this class: class MyClass { private String s; // more attributes
Say I have a mysql table of names and one column has the following
Say I have the following model: class Foo(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField()
Say I have a textbox in HTML using the following code: <input type=text name=text
Say a user visits the page http://somedomain.com/path/file.html#foo , I'd like to display, using JavaScript,
Say we have a select box: /app/views/tape/_form.html.erb <%= f.select :tape, Tape::LIST_TAPES %> and a

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.