|
-
Feb 9th, 2010, 08:23 AM
#1
Thread Starter
Frenzied Member
-
Feb 9th, 2010, 08:40 AM
#2
Re: RegEx questions!
RegExLib.com is the best place to start and for implementing with .net you could visit MSDN
Please mark you thread resolved using the Thread Tools as shown
-
Feb 9th, 2010, 08:40 AM
#3
Re: RegEx questions!
I can answer 1 of your questions
1/ Try this
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 9th, 2010, 11:22 AM
#4
Re: RegEx questions!
1. I use this free tool to learn/test regex patterns
http://www.ultrapico.com/Expresso.htm
2. Use a List(Of String) is a better choice than the old arraylist class. You can then call one of its find methods (Find, FindAll, FindIndex, FindLast....). MSDN even has an example on this.
3. Using regex.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Feb 9th, 2010, 04:48 PM
#5
Thread Starter
Frenzied Member
Re: RegEx questions!
Ok,
I've found that I can use the following regex to pick up the link, but how do i capture the text?
(<link>) will capture the first one, but how do i know when it is ending?
<[^<]+?> will capture all tags between which has < > enclosing it.
Could you please help me? I dont know how to capture the link enclosed between <link></link>
cheers
If you find my thread helpful, please remember to rate me 
-
Feb 9th, 2010, 05:16 PM
#6
Re: RegEx questions!
Try this pattern
Code:
Dim pattern as string = "(?<=\<link\>).+(?=\</link\>)"
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Feb 9th, 2010, 07:35 PM
#7
Thread Starter
Frenzied Member
Re: RegEx questions!
' Regex match
Dim options As RegexOptions = RegexOptions.None
Dim regex As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("<link\b[^>]*>(.*?)</link>")
Dim input As String = Me.TextBox1.Text
' Get matches
Dim matches As MatchCollection = regex.Matches(input)
Dim i As Integer
For i = 0 To matches.Count - 1
' TODO: Do something with result
System.Windows.Forms.MessageBox.Show(matches(i).Groups(1).Value, "Match")
Next i
If you find my thread helpful, please remember to rate me 
-
Feb 9th, 2010, 07:36 PM
#8
Thread Starter
Frenzied Member
Re: RegEx questions!
vb Code:
' Regex match
Dim options As RegexOptions = RegexOptions.None
Dim regex As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("<link\b[^>]*>(.*?)</link>")
Dim input As String = Me.TextBox1.Text
' Get matches
Dim matches As MatchCollection = regex.Matches(input)
Dim i As Integer
For i = 0 To matches.Count - 1
' TODO: Do something with result
System.Windows.Forms.MessageBox.Show(matches(i).Groups(1).Value, "Match")
Next i
If you find my thread helpful, please remember to rate me 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|