RE: [PHP] Regular Expressions
| From: | John Holmes | Date: | Thu, 25 Apr 2002 03:46:30 +0000 |
| Subject: | RE: [PHP] Regular Expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94486@lists.php.net to get a copy of this message | ||
I don't know what the original question was, but there is a parse_url
function that'll break apart a url into it's various parts. Quote from
manual:
www.php.net/parse_url
-------
Here is a good example of how it would parse this url:
http://name:pass@127.0.0.1:6667/pages/page.php?foo=bar#bookmark
(URL is fake)
This URL uses HTTP, the HTAccess name and password are name and pass,
it's
a localhost, on port 6667. The file page.php is being queried with
foo=bar. It is also set to scroll to the 'bookmark' anchor
Parse URL would give us
[scheme] = 'http'
[host] = '127.0.0.1'
[port] = 6667 (Is an INT, not a STRING)
[user] = 'user'
[path] = '/pages/page.php'
[query] = 'foo=bar'
[fragment] = 'bookmark'
Hopefully this will help someone.
--------
I don't know if it does any checking or validating or what...but maybe
it'll help??
---John Holmes...
> -----Original Message-----
> From: Miguel Cruz [mailto:mnc@stoic.net]
> Sent: Wednesday, April 24, 2002 5:17 PM
> To: Evan Nemerson
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Regular Expressions
>
> On Wed, 24 Apr 2002, Evan Nemerson wrote:
> > A domain cannot contain an underscore, but unless i'm mistaken the
> > USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+
> >
> > ereg("([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+",$variable);
>
> Right you are. I spaced out right past the @.
>
> But on the other hand usernames can contain all sorts of other
characters
> too. = and + are popular among people who give out multiple addresses
for
> mailbox filtering.
>
> miguel
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php