Skip to content

cosimomeli/angular-xregexp

Repository files navigation

angular-xregexp

XRegExp validator for AngularJS. This library decorates ngPattern to use XRegExp for more complex regular expression.

Installation

You can choose your preferred method of installation:

  • Through bower: bower install angular-xregexp --save
  • Through npm: npm install angular-xregexp xregexp --save
  • Download from github: angular-xregexp.min.js

Usage

Include both xregexp-all.js and angular-xregexp.js in your application.

<script src="components/xregexp/xregexp-all.js"></script>
<script src="components/angular-xregexp/angular-xregexp.js"></script>

Add the module angularXRegExp as a dependency to your app module:

var myapp = angular.module('myapp', ['angularXRegExp']);

Then just use ng-pattern as always.

License

Released under the terms of the MIT License.