473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Regular Expressions to find URL's in text

I am working on an ASP page that parses text using the VBScript.RegExp
regular expression object. My reg expression right now is as follows:

[a-z]+\.[a-z]+\.[a-z]+/

And if find URL's no problem like: windowsupdate.microsoft.com,
www.cnn.com, etc.

But I need to also find any URL, like these:

www.amazon.com/books/atoz/index.html
OR
msdn.microsoft.com/newsgroups/default.aspx

Some URL with a deeper path than something.something.com if that makes
sense. Any ideas?
Jul 19 '05 #1
3 2464
Nah...

What happens if someone writes a sentence and forgets to put a space between
the last word of the sentence, the period and the first word of the next
sentence?

URLs can take many forms and definitely don't need three parts. Some have
two some have four. What happens if someone puts in an IP address?

To get round the path/page name problem you should able to say where your
pattern matches anywhere in the string, not matches exactly.

Sorry to be the bearer of bad news.
"SROSeaner" <SR*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
I am working on an ASP page that parses text using the VBScript.RegExp
regular expression object. My reg expression right now is as follows:

[a-z]+\.[a-z]+\.[a-z]+/

And if find URL's no problem like: windowsupdate.microsoft.com,
www.cnn.com, etc.

But I need to also find any URL, like these:

www.amazon.com/books/atoz/index.html
OR
msdn.microsoft.com/newsgroups/default.aspx

Some URL with a deeper path than something.something.com if that makes
sense. Any ideas?

Jul 19 '05 #2
SROSeaner <SR*******@discussions.microsoft.com> wrote in message news:<FA**********************************@microso ft.com>...
I am working on an ASP page that parses text using the VBScript.RegExp
regular expression object. My reg expression right now is as follows:

[a-z]+\.[a-z]+\.[a-z]+/

And if find URL's no problem like: windowsupdate.microsoft.com,
www.cnn.com, etc.

But I need to also find any URL, like these:

www.amazon.com/books/atoz/index.html
OR
msdn.microsoft.com/newsgroups/default.aspx

Some URL with a deeper path than something.something.com if that makes
sense. Any ideas?


Why don't you just parse it to the first / character, and see if that conforms?
Jul 19 '05 #3
Thanks for your help. I got my parser to get all URL's in many forms
including IP addresses all from a disorganized html file. It is possible,
just a bugger to get going.

"Larry Bud" wrote:
SROSeaner <SR*******@discussions.microsoft.com> wrote in message news:<FA**********************************@microso ft.com>...
I am working on an ASP page that parses text using the VBScript.RegExp
regular expression object. My reg expression right now is as follows:

[a-z]+\.[a-z]+\.[a-z]+/

And if find URL's no problem like: windowsupdate.microsoft.com,
www.cnn.com, etc.

But I need to also find any URL, like these:

www.amazon.com/books/atoz/index.html
OR
msdn.microsoft.com/newsgroups/default.aspx

Some URL with a deeper path than something.something.com if that makes
sense. Any ideas?


Why don't you just parse it to the first / character, and see if that conforms?

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: David Lees | last post by:
I forget how to find multiple instances of stuff between tags using regular expressions. Specifically I want to find all the text between a series of begin/end pairs in a multiline file. I...
8
by: Michael McGarry | last post by:
Hi, I am horrible with Regular Expressions, can anyone recommend a book on it? Also I am trying to parse the following string to extract the number after load average. ".... load average:...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
3
by: Joe | last post by:
Hi, I have been using a regular expression that I don’t uite understand to filter the valid email address. My regular expression is as follows: <asp:RegularExpressionValidator...
3
by: rdi | last post by:
I get the idea of how to create the search patterns. But what I'm having trouble with is how to actually implement regular expressions. I can't seem to find any code that actually USES them. In...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
3
by: Chris | last post by:
Hi everyone, I'm trying to parse through the contents of some text files with regular expressions, but am new to regular expressions and how to use them in VB.net. I'm pretty sure that the...
0
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.