mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Simplified Regex usage in JS
Follows 70752b0fc1dde9a32d3565759d77072d3187f4eb
This commit is contained in:
@ -225,16 +225,14 @@ yii.validation = (function ($) {
|
||||
return;
|
||||
}
|
||||
|
||||
var regexp = /:\/\//;
|
||||
if (options.defaultScheme && !regexp.test(value)) {
|
||||
if (options.defaultScheme && !/:\/\//.test(value)) {
|
||||
value = options.defaultScheme + '://' + value;
|
||||
}
|
||||
|
||||
var valid = true;
|
||||
|
||||
if (options.enableIDN) {
|
||||
regexp = /^([^:]+):\/\/([^\/]+)(.*)$/;
|
||||
matches = regexp.exec(value);
|
||||
var matches = /^([^:]+):\/\/([^\/]+)(.*)$/.exec(value);
|
||||
if (matches === null) {
|
||||
valid = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user