Cool,, I was wondering once the URL is detected, is there a way of clicking that url in the richtextbox and lanuching a webpage of that link.
Main Topics
Browse All TopicsI am looking for codes examples for detecting a web page link in a rich textbox. I need help on this , I was wondering should a regex declaration be utilized. Thank you john
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The RichTextBox already does this for you....
See:
http://www.experts-exchang
Private Sub RichTextBox1_LinkClicked(B
System.Diagnostics.Process
End Sub
RichTextBox.LinkClicked():
http://msdn2.microsoft.com
Business Accounts
Answer for Membership
by: igor_alphaPosted on 2007-05-15 at 15:32:01ID: 19096882
Hello John81,
-]+(/[\w- ./?%&=]*)?"
-]+(/[\w- ./?%&=]*)?" .Text) Then
You can use following function to locate URLs in string:
Public Function Locate(ByVal pattern As String, ByVal TextFrom As String) As String
Dim text As String = TextFrom
Dim pat As String = pattern
Dim sb As StringBuilder = New StringBuilder
Dim r As Regex = New Regex(pat, RegexOptions.IgnoreCase)
Dim m As Match = r.Match(text)
While m.Success
For Each g As Group In m.Groups
Dim cc As CaptureCollection = g.Captures
For Each c As Capture In cc
If Regex.IsMatch(c.ToString, pat) Then
sb.Append("URL:" & c.ToString)
End If
Next
Next
m = m.NextMatch
End While
Return sb.ToString
End Function
Using:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim Pattern As String = "http(s)?://([\w-]+\.)+[\w
Dim s As String = Locate(Pattern, RichTextBox1.Text)
End Sub
If you want just detect that richtextbox contain Url you can do like following:
Dim Pattern As String = "http(s)?://([\w-]+\.)+[\w
Dim regex As Regex = New Regex(Pattern)
If regex.IsMatch(RichTextBox1
'match
Else
'dont't match
End If