public function validate($validator)
    {
        $this->value = trim($this->value);
        $regex = $this->config['validregex'];
        if ($this->value && $regex && !preg_match($regex, $this->value)) {
            $validator->validationError(
                $this->name,
                _t('ExternalURLField.VALIDATION', "Please enter a valid URL"),
                "validation"
            );
            return false;
        }
        return true;
    }
public function validate($validator)
    {
        $this->value = trim($this->value);
        $regex = $this->config['validregex'];
        if ($this->value && $regex && !preg_match($regex, $this->value)) {
            $validator->validationError(
                $this->name,
                _t('ExternalURLField.VALIDATION', "Please enter a valid URL"),
                "validation"
            );
            return false;
        }
        return true;
    }
public function validate ( $ validator ) { $ this -> value = trim ( $ this -> value ) ; $ regex = $ this -> config [ 'validregex' ] ; if ( $ this -> value && $ regex && ! preg_match ( $ regex , $ this -> value ) ) { $ validator -> validationError ( $ this -> name , _t ( 'ExternalURLField.VALIDATION' , "Please enter a valid URL" ) , "validation" ) ; return false ; } return true ; }
Server side validation, using a regular expression.
Server side validation using a regular expression .