Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regexp to search in "http://www.server.com"

Status
Not open for further replies.
A cheaty way:
Code:
print join &quot;/&quot;, ( split </>, $url )[0..2], &quot;\n&quot;;
Cheers, Neil S-)
 
There are many complicated regexs you can use including one that is in the core library. But what I have used to look for Dns names is to use something like this:
'\b(http:\/\/\w+\.\w+\.\w+\.com)\b'

Of course you'll have to enhance this a bit because it was designed to only account for specific addresses within my company.
1. to account make http case insensitive
2. you'll need to take out the duplicated groups and use a repeating quantifiers.

something like this (http:\/\/:\w+(\.\w+)+)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top