QF: Registerrule(), regular expression for checking url

From: Date: Thu, 15 Apr 2004 10:36:03 +0000
Subject: QF: Registerrule(), regular expression for checking url
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11853@lists.php.net to get a copy of this message
Hi As far as I remember I've formerly used this line $form->registerRule('url', 'regex', '/^(file|ldap|http|https|ftp)://(([-a-z0-9])+\.)+([a-z]{2,6}|([a-z/]+[a-z/]{2,6}))$/'); to add a rule verifying if a form field contains a valid url - apparently the '/' is making problems now since I'm getting the following error: Warning: Unknown modifier '/' in Z:\www_test\cmjern\pear\HTML\QuickForm\Rule\Regex.php on line 57 Can anyone fix the above regular expression or perhaps come up with a better one? I know that it's allowing many invalid url's but it's just meant as a crude check to help the user. This means I will rather accept an invalid url than reject a valid one! Hope you can help! Cheers, Tommy Ipsen

« previous php.pear.general (#11853) next »