Regex to extract link
Posted
by
Derin
on Stack Overflow
See other posts from Stack Overflow
or by Derin
Published on 2010-12-27T07:46:20Z
Indexed on
2010/12/27
7:54 UTC
Read the original article
Hit count: 509
Hi,
I'm looking for a regex to extract links from a url. The url would be as below:
/redirecturl?u=http://www.abc.com/&tkn=Ue4uhv&ui=fWrQfyg46CADA&scr=SSTYQFjAA&mk=4D6GHGLfbQwETR
I need to extract the link http://www.abc.com from the above url.
I tried the regex:
redirecturl\\?u=(?<link>[^\"]+)&
This works, but the problem is that it does not truncate all the characters after the first occurrence of &.
It would be great if you could modify the regex so that I just get the link.
Thanks in advance.
© Stack Overflow or respective owner