regex for url paramter

A

Andreas Volz

Hi,

I try to extract a http target from a URL that is given as parameter.
urlparse couldn't really help me. I tried it like this

url="http://www.example.com/example.html?url=http://www.example.org/exa
mple.html"

p = re.compile( '.*url=')
url = p.sub( '', url)
print url

This works, but if there're more parameters it doesn't work:

url2="http://www.example.com/example.html?url=http://www.example.org/exa
mple.html&param=1"

p = re.compile( '.*url=')
url2 = p.sub( '', url2)
print url2

I played with regex to find one that matches also second case with
multible parameters. I think it's easy, but I don't know how to do. Can
you help me?

regards
Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top