Jump to content
Xtreme .Net Talk

How can I find all www.?????.com in a txt document?


Recommended Posts

Posted

I am trying to search through a txt document line by line and get any webpage out of it.

 

I have been learning about regex.. but I believe this will just return the whole line of there is a webaddress on it.

 

(to recap, I want any address..something like http://www.a.com, http://www.bcr.com, http://www.yada.com, http://www.etc.com)

 

I am trying to use:

Dim rx As New Regex("www\.*[\.net|\.com|\.org]")

 

But this is just returning the whole line (I think?)

 

What should I do to just return the website's url?

 

thanks

Lee

Posted

(?<=www\.)\S+(?=\.(com|org|co\.|edu|net|xxx))

 

1. [] is for matching single characters.

2. Throw in ?: groups if you need better performance.

3. There is a RegEx forum.

"Who is John Galt?"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...