RegEx help pls.

  • Thread starter Thread starter Thief_
  • Start date Start date
T

Thief_

I have the following text:

<font class="sub-row">in .NET&nbsp;/&nbsp;VB.NET</font>

I want to return two values into two variables as such:

V1 = "in .NET"
V2 = "VB.NET"

Note that the above text will not always contain the words "in", "VB" and
".NET".

Thanks
 
Thief,

Why use Regex, when you can do it in a in my eyes more describing, and at
least quicker performing way, using normal code. (This does not mean that
you should forever avoid Regex, however if not needed I would try to avoid
it).

\\\
Public Class Sample
Public Shared Sub Main()
Dim str As String = "<font class=""sub-row"">in
..NET&nbsp;/&nbsp;VB.NET</font>"
Dim firstStart As Integer = str.IndexOf("sub-row") + 9
Dim firstEnd As Integer = str.IndexOf("&nbsp;/")
Dim secondStart As Integer = str.IndexOf("/&nbsp;") + 7
Dim secondEnd As Integer = str.IndexOf("</font>")
Dim v1 As String = str.Substring(firstStart, firstEnd - firstStart)
Dim v2 As String = str.Substring(secondStart, secondEnd - secondStart)
End Sub
End Class
///

I hope this helps,

Cor
 

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

Similar Threads

Find HTML tags using RegEx. 3
Extract data from web page. 2
regex evaluator 1
seek help with regular expressions 1
Newbie 7
Newbie: AJAX not working 1
RegEx question 8
Regex Help 1

Back
Top