Solved

Regular Expression - Get especific table

Posted on 2004-09-08
2
172 Views
Last Modified: 2010-04-15
Hi PLEASE HELP ME!

I have a big code with a lot of tables that have tables inside!!

I want to get only the tables that have only five <td></td>
For example:

<table [something]>
<tr[something]>
<td [something]>[something]</td>
<td [something]>[something]</td>
<td [something]>[something]</td>
<td [something]>[something]</td>
<td [something]>[something]</td>
</tr>
</table>

HELP ME PLEASE!
0
Comment
Question by:elfraga
2 Comments
 
LVL 3

Accepted Solution

by:
a_goat earned 500 total points
ID: 12017617
If you have this in an xml document you can do a select with an xpath like

//tr[count(td) = 5]

if you need to use a regex, it's a bit trickier something like

\<tr[^\<tr]+\<td[^\<tr]+\<td[^\<tr]+\<td[^\<tr]+\<td[^\<tr]+\<td.+\<\/tr\>

Which is basically look for

<tr (something) <td (something) <td (something) <td (something) <td (something) <td (something) </tr>
0
 
LVL 1

Author Comment

by:elfraga
ID: 12028598
how can i make an html code tu xml???
because
this
\<tr[^\<tr]+\<td[^\<tr]+\<td[^\<tr]+\<td[^\<tr]+\<td[^\<tr]+\<td.+\<\/tr\>

doesnt works, it find extrange things.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question