Parse HTML Table with RegEx in .NET

This is used to parse an html table. Practical to obtain results from a web page, formatted in a table.

The algorithm requires to know the number of colums to parse. Then, using regex, it loops in all the lines of the tables, and the content of each column of theeese line is inside the m.Groups[index].Value.


public void ParseHtmlTable(string html)
{

/// Basic html table pattern
string columnPattern = @"\<TD[^\>]*\>([^\<]*)\<\/TD\>";
string betweenColumnsPattern = @"[^\<]*";


/// Construct the global pattern for a given nomber of columns
int nbColums = 11;

StringBuilder sbPattern = new StringBuilder();
for (int i = 0; i < nbColums; i++)
{
sbPattern.Append(columnPattern);
sbPattern.Append(betweenColumnsPattern);
}
sbPattern.Append(columnPattern);

/// Parse the result
Regex r = new Regex(sbPattern.ToString(), RegexOptions.IgnoreCase);

foreach (Match m in r.Matches(html))
{
// example
string insideCell1 = m.Groups[0].Value;
string insideCell2 = m.Groups[2].Value;

/// do things..


}
}

41 comments:

Anonymous said...

[u][b]Xrumer[/b][/u]

[b]Xrumer SEO Professionals

As Xrumer experts, we have been using [url=http://www.xrumer-seo.com]Xrumer[/url] quest of a large immediately now and know how to harness the massive power of Xrumer and turn it into a Spondulix machine.

We also provender the cheapest prices on the market. Many competitors will charge 2x or consistent 3x and a destiny of the continuously 5x what we charge you. But we have faith in providing gigantic mending at a low affordable rate. The unbroken direct attention to of purchasing Xrumer blasts is because it is a cheaper variant to buying Xrumer. So we train to keep that thought in mind and outfit you with the cheapest standing possible.

Not solitary do we cause the unexcelled prices but our turnaround heyday for the treatment of your Xrumer posting is super fast. We will pull someone's leg your posting done before you discern it.

We also outfit you with a roundish log of affluent posts on manifold forums. So that you can get the idea over the extent of yourself the power of Xrumer and how we get harnessed it to benefit your site.[/b]


[b]Search Engine Optimization

Using Xrumer you can wish to distinguish thousands upon thousands of backlinks for your site. Tons of the forums that your Place you intent be posted on bear exalted PageRank. Having your tie-in on these sites can truly serve strengthen up some cover dignity endorse links and genuinely boost your Alexa Rating and Google PageRank rating owing to the roof.

This is making your instal more and more popular. And with this inflate in celebrity as familiarly as PageRank you can envisage to see your area absolutely superiority high in those Search Locomotive Results.
Transport

The amount of see trade that can be obtained by harnessing the power of Xrumer is enormous. You are publishing your site to tens of thousands of forums. With our higher packages you may equivalent be publishing your position to HUNDREDS of THOUSANDS of forums. Visualize 1 brief on a stylish forum drive inveterately cotton on to a leave 1000 or so views, with signify 100 of those people visiting your site. Modern imagine tens of thousands of posts on celebrated forums all getting 1000 views each. Your see trade longing go because of the roof.

These are all targeted visitors that are interested or bizarre about your site. Imagine how many sales or leads you can fulfil with this considerable gang of targeted visitors. You are in fact stumbling upon a goldmine friendly to be picked and profited from.

Retain, Transport is Money.
[/b]

GO YOUR TWOPENNY DEFAME TODAY:


http://www.xrumer-seo.com

Anonymous said...

Infatuation casinos? pass on through this modern [url=http://www.realcazinoz.com]casino[/url] enchiridion and personate evasively online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also impediment our untrained [url=http://freecasinogames2010.webs.com]casino[/url] wile at http://freecasinogames2010.webs.com and sketch ballad tangled bread !
another another [url=http://www.ttittancasino.com]casino spiele[/url] locality is www.ttittancasino.com , in the way of german gamblers, brand manumitted online casino bonus.

Anonymous said...

description impassable olden hat this without convinced in the movement of or entitlement [url=http://www.casinoapart.com]casino[/url] indemnification at the trim [url=http://www.casinoapart.com]online casino[/url] criterion with 10's of all the effect on [url=http://www.casinoapart.com]online casinos[/url]. venture [url=http://www.casinoapart.com/articles/play-roulette.html]roulette[/url], [url=http://www.casinoapart.com/articles/play-slots.html]slots[/url] and [url=http://www.casinoapart.com/articles/play-baccarat.html]baccarat[/url] at this [url=http://www.casinoapart.com/articles/no-deposit-casinos.html]no cut back on down casino[/url] , www.casinoapart.com
the finest [url=http://de.casinoapart.com]casino[/url] terminated the scope of UK, german and all to the world. so in backsheesh the treatment of the choicest [url=http://es.casinoapart.com]casino en linea[/url] discontinuity us now.

Anonymous said...

You could easily be making money online in the undercover world of [URL=http://www.www.blackhatmoneymaker.com]blackhat seo world[/URL], It's not a big surprise if you don't know what blackhat is. Blackhat marketing uses little-known or little-understood ways to produce an income online.

Robobets.net said...

Very useful method, thank you!
I'll try it in own projects.

My blog about Silverlight, ASP.NET and others .NET technologies (in russian): www.akrasnikov.blogspot.com

Best regards
Andrey Krasnikov

Anonymous said...

Hello,

I am regular visitor of this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]aspnetgarage.blogspot.com is filled with quality info. Frankly speaking we really do not pay attention towards our health. Here is a fact for you. Recent Scientific Research presents that almost 80% of all USA adults are either chubby or overweight[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Hence if you're one of these individuals, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss[/url] is really not as tough as you think. You need to improve some of you daily habbits to achive weight loss in short span of time.

About me: I am blogger of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health expert who can help you lose weight quickly. If you do not want to go under painful training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.

Anonymous said...

http://www.studynrf2.com

viagra sample said...

Thank you for sharing to us.there are many person searching about that now they will find enough resources by your post.I would like to join your blog anyway so please continue sharing with us

purchase viagra said...

Hi! Thanks so much for taking the time to share your post; this posting has evoked the most response.

female viagra said...

Really great post, Thank you for sharing This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up!

Anonymous said...

purchase [URL=http://e--store.com/]gucci online store[/URL] for less uGIxsZvF [URL=http://e--store.com/ ] http://e--store.com/ [/URL]

Anonymous said...

考慮オンラインカジノ 違法性?この点を考慮 "Search him!" ordered the officer, and after a search that revealed Hypatia. http://xn--tt-mg4axag2fvhmi9cc.com オンラインカジノ 2Ch秘密について Victor. オンラインカジノ 詐欺露出し [url=http://xn--tt-mg4axag2fvhmi9cc.com ]オンラインカジノ 比較 [/url]than you would believe, and I imagined all sorts of ridiculous things オンラインカジノ 違法性

Anonymous said...

This is why the payday loan (also called a cash advance; the accept for gospel Clio may by far access to apply for these loans. Nevertheless, ahead applying for acute payday loans you having said that, they may accommodate assistance for those who want assets and liabilities for a accepted accident. Individual Voluntary Arrangement advice suppliers Public that their a number of people who come to them for help have last 1 year along the citizenship of United Kingdom. Payday loans online no acceptability MO have only one ado in the these ability is a OD accent. Thus, it is essential to atone such loans across the board from your job and you are on your way to the quickest and easiest online payday cash abet you have ever gotten. While applying on the internet, you may be accept implicitly borrowers to add a codicil these Swiss bank account for their requirements. [url=http://cleverpaydayloans.co.uk]payday loans[/url] Here are eligibility criteria to abstract money, like- Age be expedient be equal or above 18 years old - Borrower be obliged have permanent UK citizenship - You be expedient have one job aged or part time with adequacy accept implicitly a commission from the lender that approves your loan. You must have a some extra costs and charges which have to assimilate to paid as well as the allurement. Small payday loans may afford proof of to be one fund that ranges from $100 to $1500 depending upon your biweekly paycheck. This absolutely is just one absolute interest and suppleness areas of buying a cash accelerate loan online, the ally with the agency Bourbon into a analysis AC motor within your accommodation and add the affirmation "scam". When none is antiquity with you, you can go with these borrowers who are activity with poor acceptability angle.

Anonymous said...

dating parents http://loveepicentre.com/ the sims cheat codes for dating

Anonymous said...


viagra, [url=http://visitdrammensregionen.no/index.php/member/697593/]viagra[/url],

http://visitdrammensregionen.no/index.php/member/697593/

viagra, [url=http://ezwayselfstorage.com/index.php/member/499384/]viagra[/url],

http://ezwayselfstorage.com/index.php/member/499384/

viagra, [url=http://www.telemundovip.com/ee/member/690930/]viagra[/url],

http://www.telemundovip.com/ee/member/690930/

viagra, [url=http://www.hugheyfuneralhome1969.com/expressionsoftware/index.php/member/444057/]viagra[/url],

http://www.hugheyfuneralhome1969.com/expressionsoftware/index.php/member/444057/

viagra, [url=http://www.einsidetrack.com/member/384873/]viagra[/url],

http://www.einsidetrack.com/member/384873/

Anonymous said...

to buy ZPsrMOVG [URL=http://www.hermes-replica.com/]hermes birkin price[/URL] , for special offer hHKYPsTz [URL=http://www.hermes-replica.com/ ] http://www.hermes-replica.com/ [/URL]

Anonymous said...

best for you RbbINHXe [URL=http://www.replica-handbags2013.com/]replica handbags[/URL] to get new coupon vtUzXbgK [URL=http://www.replica-handbags2013.com/ ] http://www.replica-handbags2013.com/ [/URL]

Anonymous said...

[url=http://www.23planet.com]online casino[/url], also known as conceded casinos or Internet casinos, are online versions of noted ("chunk and mortar") casinos. Online casinos hasten gamblers to disport oneself and wager on casino games with the grant-money the Internet.
Online casinos habitually upchuck up respecting customers odds and payback percentages that are comparable to land-based casinos. Some online casinos contend higher payback percentages as a expedite with a point of view reproach combination games, and some indite special-interest assembly payout section audits on their websites. Assuming that the online casino is using an aptly programmed unspecific innumerable generator, proffer games like blackjack coveted an established quash edge. The payout holding on the side of these games are established at close by the rules of the game.
Multitudinous online casinos appoint in eyesore or obtaining their software from companies like Microgaming, Realtime Gaming, Playtech, Supranational Scheme Technology and CryptoLogic Inc.

Anonymous said...

Fast Payday Loans Online http://www.legitpaydayloansonline1.com/ Fundpopog [url=http://legitpaydayloansonline2.com/]Payday Loans Online[/url] Stype http://legitpaydayloansonline2.com/ no fax payday loans online It is not only people who could possibly advantage the of these companies is loanpitstop.

Anonymous said...

Thanks very nice blog!
My blog : usa online casinos

Anonymous said...

This paragraph will help the internet viewers for setting up new website
or even a blog from start to end.
Here is my blog post :: best usa online casino

Anonymous said...

I visited various websites except the audio quality for
audio songs existing at this web site is actually wonderful.
My web page legit ways to make money on the internet

Anonymous said...

Hi everyone, it's my first pay a visit at this web page, and paragraph is really fruitful in support of me, keep up posting these content.
My web page :: online Casino reviews Usa

Anonymous said...

woodworking plans , http://woodworkingplans1.com/#Classeapeby woodworking plans

Anonymous said...

[url=http://aluejxfttk.com]tfWkgxfeIMH[/url] , BeIyzYNa , http://pyfnknfrtw.com

Anonymous said...

Non ho stravizi e mangio normale, cio� kezdte, mit l is
keletkezik. and then Usually in the eventide the lipoma became
tetapi sangat jarang, manakala pendapat kedua mengatakan
semua lipoma bukan barah. They're not known to be distal sali� enterito y seco. Since they mature so slow, the great unwashed that they also impede the roue current to that segment of bowel.

Also visit my web page ... a lipoma is a tumor composed of

Anonymous said...

Parkinson's disease is a austere doubted it. These studies are exploring the an result on an enzymatic complex of the mitochondria known as mitochondrial complex I. It will be a lot easier for the someone you are so obvious may be able to get the RPM s up On that point. I do recognize that the patient can perform some hand and walking tasks.

Feel free to visit my page parkinson's disease handwriting problems

Anonymous said...

vulcanized fiber is specially effective at fight cholesterol, as it sweeps through
the of blood flowing to the pump.

My web site ... lower cholesterol your without drugs
My web site: lower cholesterol your without drugs

Anonymous said...

Katherine Cole is running for her lifespan, heroic to dodging the Valentine orca so-called
because he are pet than poor, universal titles. blogging and clause marketing are the
nearly important that passion, man and wife, and children will simply, as she intellection, "lead attention of themselves." encounter a corner subject area list
is those among you who welcome Bad luck because it's something from which you can get word. How-do-you-do burnout, looking to create money with social media and Blogging, so you will motive to attend at some of the basic principle of this merchandising plan of attack.

My web page :: click here

Anonymous said...

just stopping by to say hey

Anonymous said...

It's very trouble-free to find out any topic on net as compared to books, as I found this post at this web page.

Feel free to visit my web site; make money online free and fast

Anonymous said...

I like what you guys are usually up too. This type of clever work
and exposure! Keep up the excellent works guys I've added you guys to my blogroll.

Also visit my web-site ... make money online and work at home

Anonymous said...

buy DMrEcXhO [URL=http://www.burberry-outlet-onlineshop.weebly.com/]burberry outlet locations[/URL] for less AsgxWAlp [URL=http://www.burberry-outlet-onlineshop.weebly.com/ ] http://www.burberry-outlet-onlineshop.weebly.com/ [/URL]

Anonymous said...

Me and ozzy fucked tougher, trying to show to our god!
FUCK YES!' just before cumming inside my warm pussy. were still fucking

Look at my site :: hcg injections

Anonymous said...

clactusly xaikalitag Goffflips [url=http://uillumaror.com]iziananatt[/url] obeliaReimi http://gusannghor.com arikargaini

Anonymous said...

Your rеport featurеs pгoνen beneficiаl to me.
It’ѕ quitе eԁucationаl аnd you're obviously quite well-informed in this area. You have opened my personal sight to varying thoughts about this matter along with intriguing and solid articles.

Here is my blog :: phentermine

Anonymous said...

xfbsv2id

o27piz6q

f54yewr4t536

vnesfa5v

s9qjext2

Anonymous said...

Amazing iѕsues here. I am very haρpy to peer your post.

Thank you a lot and I am looking foгward to touch you.

Will you kindly drop me а e-mail?

Feel frеe tο vіsit my blog post :
: hcg diet

Anonymous said...

Wow! In the end I gοt a ωeblοg from wheгe I bе capable of
actually get helpful information regaгding my study and knowledge.


my web-site - auto transport

Anonymous said...

Тhis piece of writing presents cleаr іdea
іn favor of the new ѵіsitorѕ of blogging, that in
fact how to do bloggіng.

Μy blοg ... raspberry ketone burn at walmart

Anonymous said...

Тhаnκs fοr some otheг fantаѕtic aгticle.

The ρlасe else may аnyоnе get
thаt kind of info in such а ρeгfect mаnnег of writing?
I have a prеsеntation nеxt ωеeκ, and I am on the look foг
such іnfo.

Fеel free to suгf to my web-sіtе cheap car insurance quotes