Correct a regular expression for urls

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8558 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-07-01 02:59:43 +00:00
parent 4d26d3b980
commit 402bfe6ab5
2 changed files with 2 additions and 2 deletions

View file

@ -27,7 +27,7 @@ class Validator
$this->addRule(array(
'email' => '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/',
'userid' => '/^[a-z]+[\w-]*[a-z0-9_]+$/i',
'url' => '/^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:[0-9]+)/',
'url' => '/^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:\d+)?/',
'alpha' => '/^[a-z]*$/i',
'alpha_number' => '/^[a-z][a-z0-9_]*$/i',
'number' => '/^(?:[1-9]\\d*|0)$/'

View file

@ -28,7 +28,7 @@ var Validator = xe.createApp('Validator', {
this.cast('ADD_RULE', ['user_id', regUserid]);
// url
var regUrl = /^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-\/\~]+)+(:[0-9]{2,4})*$/;
var regUrl = /^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:\d+)?/;
this.cast('ADD_RULE', ['url', regUrl]);
this.cast('ADD_RULE', ['homepage', regUrl]);