Avatar of rosa545
rosa545
 asked on

Regex for URL parsing

I want to make a regex to get all the url of the web page visited any helps that could work on all sites from search engines to any other visited website
.NET ProgrammingRegular Expressions

Avatar of undefined
Last Comment
kaufmed

8/22/2022 - Mon
rosa545

ASKER
i worked out the code but the issue is that it keeps on adding to old links how can i update the textbox with new source each time???


Dim pattern As String = "((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"

        Dim pattern1 As New System.Text.RegularExpressions.Regex(pattern)

        Dim m As MatchCollection = pattern1.Matches(TextBox1.Text)


        For Each link As Match In m   
                ListBox1.Items.Add(link)

    Next

Textbox1.text=webbrowser1.documenttext

Open in new window

hongjun

What do you mean by adding new source?
rosa545

ASKER
see when i load page one it source gets into text box and adds links to listbox1

then when i navigate to another page the html source does not goes to textbox 1 and the links get added in listbox1 that are already been there
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
kaufmed

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question