Regular Expression Help

O

orianavim

Hi,

i'm looking to find a way (using RegEx) to take the following text
break it into 3 parts:

<table><tr><td>#Content#</td></tr></table> which will give me an
collection/list with 3 elements:

<table><tr><td>
#Content#
</td></tr></table>

please keep in mind that the html might be diferent and i might have
more than one #content# elements, i just looking for a simple way to
break it out.

Thanks.
 
K

Kevin Spencer

Okay, we need to get a little more precise. Let's see if we can define some
concrete rules. Here's what I'm guessing so far:

You want to separate the content in table cells from the table tags in a
table.

Now, for the questions:

1. Do you also want to capture the table tags themselves, perhaps in a
different group?
2. Will the text contain other HTML besides tables?
3. You started by saying "3 parts," but added that there might be "more than
one #content# elements." According to my initial understanding of your
requirement, the number of cells to get content from might be variable. But
since you said "3 parts" and your illustration showed a table with 1 cell
and 1 row, it could imply that there will always be "3 parts" or "Matches"
in the results. So, I must ask:
a. Was my first guess at your rules correct?
b. Would your table conceivably have more than one column in it?
c. Would your table conceivably have more than one row in it?
d. Assuming that c and d are true, do you want to separate the content
in different cells?

Any clarification and/or additional rules will be helpful. Remember that a
Regular Expression is an exact set of rules. It will perform exactly what
you tell it to, regardless of your intention. It is therefore up to you to
make your intentions perfectly clear.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.
 
K

KeyboardSurfer

truth is , it helps to define an Information Model and state diagrams
or in newer technologies try using UML with its use cases and the like so
you can really define what you want/need , then post a question that is
clear and consise :)
 
K

Kevin Spencer

Ouch! That hurts my agile sensibilities!

--
;-),

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top