class RegexConstraint

Same name in other branches
  1. 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RegexConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint
  2. 10 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RegexConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint
  3. 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RegexConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint

Regex constraint.

Overrides the symfony constraint to use Drupal-style replacement patterns.

Plugin annotation


@Constraint(
  id = "Regex",
  label = @Translation("Regex", context = "Validation")
)

Hierarchy

  • class \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint extends \Symfony\Component\Validator\Constraints\Regex

Expanded class hierarchy of RegexConstraint

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RegexConstraint.php, line 17

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class RegexConstraint extends Regex {
    public $message = 'This value is not valid.';
    
    /**
     * {@inheritdoc}
     */
    public function validatedBy() {
        return '\\Symfony\\Component\\Validator\\Constraints\\RegexValidator';
    }

}

Members

Title Sort descending Modifiers Object type Summary
RegexConstraint::$message public property
RegexConstraint::validatedBy public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.