Regular expression question.

G

Guoqi Zheng

Sir,

I am writing a script to remove html tag using Regular expression.

For example, I have a string = "<td class="whatever" width=12>some content
here</td>"

What I want to return is "<td class="whatever" width=12>", I used pattern =
"<td(.*)>"

However instead of returning "<td class="whatever" width=12>"
it returns "<td class="whatever" width=12>some content here</td>"


Below is my code, what did I do wrong here?

Dim webPage As String = GrabUrl()
Dim abc As ArrayList = New ArrayList
RichTextBox1.Text = webPage

Dim TagExpression As New Regex("<td(.*)>", RegexOptions.IgnoreCase)
Dim mc As RegularExpressions.MatchCollection

mc = TagExpression.Matches(webPage)

Dim m As Match

For Each m In mc
abc.Add(m.Groups(0))
Next

ListBox1.DataSource = abc

--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top