code: 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;
      }
docs: Server side validation, using a regular expression.