QuickForm->Addrule->Regular Expression->URL check!
| From: | Tommy Ipsen | Date: | Sun, 03 Aug 2003 10:11:22 +0000 |
| Subject: | QuickForm->Addrule->Regular Expression->URL check! | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6968@lists.php.net to get a copy of this message | ||
Hi
I'm trying to compose a regular expression to check an URL via the QuickForm rules. Unfortunately I can't seem to get the regexp entirely correct :-(
The check shouldn't be thorough in the sense that it should only catch really bad URLs - it shouldn't be so strict that correct URL's could be rejected!
I've tried using something like the following:
$this->registerRule('url', 'regex', '/^(file|ldap|http|https|ftp)://(([-a-z0-9])+\.)+([a-z]{2,6}|([a-z/]+[a-z/]{2,6}))$/');
but it creates javascript errors when trying to do client-side validation! I guess because the format isn't entirely correct!
Do any of you have any suggestions for an URL-checker which isn't to strict?
Regards,
Tommy Ipsen