Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Highlight numbers using regex

$
0
0
Hello guys,
I am a beginer in vb.net and I have a question about regular expressions:

I want to highlight in a richtextbox only telephone numbers...from a phrase or a sentence.

here's my code
Dim r As Regex = New Regex("\b\d{10}", RegexOptions.Multiline)
Dim Mtch As MatchCollection = r.Matches(RichTextBox1.Text)
Dim result As String = ""
Dim i As Integer
For i = 0 To Mtch.Count - 1
Dim mat As Match = Mtch.Item(i)
result = result & vbCrLf & mat.Value



How can i link this result to rtb.select method ?

Thanks in advance

Viewing all articles
Browse latest Browse all 51036

Trending Articles