You are here

class RegexConstraint in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RegexConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint
  2. 9 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