Re: [Phplib-users] regexp url ohhforms
Brought to you by:
nhruby,
richardarcher
From: Michael C. <mdc...@mi...> - 2002-07-08 15:18:35
|
On Mon, Jul 08, 2002 at 02:09:19PM +0200, Bertram Simon wrote: > Hi there, > > I am looking for a regular expresions, which hits a complete url in > oohforms: > > http://www.foo.com/index.php > http://www.foo.com/default.asp?id=1&m=2 > https://www.foo.de > > Any ideas? > > This is my last version, but i doesn't work: > > (^$)|(^http\://[a-z0-9\.-]+\.[a-z]{2,3}(/\S*)?$) Here's the last regular expression that I did to parse a url: /^(?:([a-zA-Z]+)\:\/\/)?(?:([A-Za-z0-9\_\.\-]*?)(?:\:([A-Za-z0-9\_\.\-]*?))?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:(\/(?:[^\?]*?\/)*)([^\?]*?)?(?:\?(.*?))?(?:#(.*))?)?$/ It matches (in this order): $service,$user,$password,$host,$port,$path,$file,$params,$anchor URL matching is non-trivial. Michael -- Michael Darrin Chaney mdc...@mi... http://www.michaelchaney.com/ |