public function validateMatchesRegex(ElementInterface $element, array $params = null)
    {
        $value = $element->getFieldValue($this->handle);
        $match = preg_match($this->inputMask, $value);
        if ($match !== 1)
        {
            $element->addError($this->handle, Craft::t('site', $this->errorMessage));
        }
    }
public function validateMatchesRegex(ElementInterface $element, array $params = null)
    {
        $value = $element->getFieldValue($this->handle);
        $match = preg_match($this->inputMask, $value);
        if ($match !== 1)
        {
            $element->addError($this->handle, Craft::t('site', $this->errorMessage));
        }
    }
public function validateMatchesRegex ( ElementInterface $ element , array $ params = null ) { $ value = $ element -> getFieldValue ( $ this -> handle ) ; $ match = preg_match ( $ this -> inputMask , $ value ) ; if ( $ match !== 1 ) { $ element -> addError ( $ this -> handle , Craft :: t ( 'site' , $ this -> errorMessage ) ) ; } }
Validates the field value.

@param ElementInterface $element
@param array|null       $params

@return void
Validates the field value .