By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,814 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,814 IT Pros & Developers. It's quick & easy.

simple url regexp

P: n/a
url = re.compile(r"((http|ftp|https)\:\/\/)(www)?([a-zA-Z]{1}([\w\-]+
\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+
\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?")

damn i hate these things.

i want it to only match http://www.name.any/etc

not http://wiki.x etc

Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
no**********@yahoo.se wrote:
url = re.compile(r"((http|ftp|https)\:\/\/)(www)?([a-zA-Z]{1}([\w\-]+
\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+
\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?")

damn i hate these things.

i want it to only match http://www.name.any/etc

not http://wiki.x etc
Why don't you use urlparse and check the result yourself?

Stefan
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.