angular.validator.regexp

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

Description

Use regexp validator to restrict the input to any Regular Expression.

Dependencies

Usage

In HTML Template Binding

<input type="text" ng:validate="regexp:expression[:msg]"/>

In JavaScript

angular.validator.regexp(value, expression[, msg])

Parameters

Example

<script> function Cntl(){ this.ssnRegExp = /^\d\d\d-\d\d-\d\d\d\d$/; } </script> Enter valid SSN: <div ng:controller="Cntl"> <input name="ssn" value="123-45-6789" ng:validate="regexp:ssnRegExp" > </div>