RE: [PHP] regexp for URL

2003-06-08 Thread Boaz Yahav
Try this :

How to use regular expressions to get the list of links from an HTML
page
http://examples.weberdev.com/get_example.php3?count=1401

extract_links(); Extract all local links from a URL
http://examples.weberdev.com/get_example.php3?count=

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-Original Message-
From: Mattia [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 09, 2003 7:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regexp for URL


Does anyone have a good regular expression for capturing all http URL in

a string?
now i'm using ?(http://[a-z0-9-/_;&=+-\.\?:@]+)\b?mi
in one of my programs, that is, all strings beginning with http:// and 
contain chars like a-z0-9 ...

does anione have something better?

thank you


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] regexp for URL

2003-06-08 Thread David Otton
On Mon, 09 Jun 2003 07:13:43 +0200, you wrote:

>Does anyone have a good regular expression for capturing all http URL in 
>a string?
>now i'm using ?(http://[a-z0-9-/_;&=+-\.\?:@]+)\b?mi
>in one of my programs, that is, all strings beginning with http:// and 
>contain chars like a-z0-9 ...
>
>does anione have something better?

Hmm. I just glanced at RFC 2396, which offers this regex to validate an URI:

^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
 123  4  5   6  78 9

the numbers indicate the reference points for each subexpression

1 = http:
2 = http
3 = //www.ics.uci.edu
4 = www.ics.uci.edu
5 = /pub/ietf/uri/
6 = 
7 = 
8 = #Related
9 = Related

http://www.ietf.org/rfc/rfc2396.txt


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] regexp for URL

2003-06-08 Thread Mattia
Does anyone have a good regular expression for capturing all http URL in 
a string?
now i'm using ?(http://[a-z0-9-/_;&=+-\.\?:@]+)\b?mi
in one of my programs, that is, all strings beginning with http:// and 
contain chars like a-z0-9 ...

does anione have something better?

thank you

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php