Page 1 of 1

URL Regex

Posted: Mon Nov 19, 2007 11:51 am
by sjeakins
Hi Folks,

Is there any way to capture the URL from this text using only one regex expression?

<td><span class="proxy77602">202</span>.<span class="proxy77602">115</span>.130.23:
8080</td>

TIA,

Sandy Jeakins

Posted: Mon Nov 19, 2007 12:07 pm
by John Cartwright
What URL?

Posted: Mon Nov 19, 2007 12:32 pm
by Zoxive
Jcart wrote:What URL?
Thats what i thought, but there is an IP.

Posted: Mon Nov 19, 2007 12:38 pm
by feyd
Zoxive wrote:
Jcart wrote:What URL?
Thats what i thought, but there is an IP.
Mashed in the middle of a bunch of HTML. Honestly, I'd do a strip_tags() type thing, then massage from there, if necessary.

Posted: Mon Nov 19, 2007 1:29 pm
by John Cartwright

Code: Select all

/>([0-9\.:]+)/m
Will match your specific example. Most likely you will need to tweak it to suit your needs.

Posted: Mon Nov 19, 2007 1:51 pm
by GeertDD
Jcart wrote:

Code: Select all

/>([0-9\.:]+)/m
No need to escape metacharacters inside a character class.

Code: Select all

/>([0-9.:]+)/m

Posted: Mon Nov 19, 2007 2:07 pm
by John Cartwright
Woohoo! Good to know :)

Posted: Wed Nov 21, 2007 4:28 pm
by sjeakins
Yes, sorry - IP.