By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,835 Members | 1,048 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,835 IT Pros & Developers. It's quick & easy.

RegEx help pls.

P: n/a
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_
|
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.