Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Regular Expression - Get especific table

Posted on 2004-09-08
2
Medium Priority
?
178 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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview

783 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