Solved

Regular Expression - Get especific table

Posted on 2004-09-08
2
171 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

816 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now