Solved

Regular Expression - Get especific table

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

24 Experts available now in Live!

Get 1:1 Help Now