Solved

Regular Expression - Get especific table

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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