@mkazlauskas/plastik-regex-validator
v3.0.0
Published
Regular expression validator for Polymer
Downloads
4
Maintainers
Readme
plastik-regex-validator
plastik-regex-validator
validates user input against a specified regular expression.
Demos and documentation are available on the component page.
Pull requests are always welcome. If you encounter any bugs, please feel free to submit an issue.
Installation
bower install plastik-regex-validator --save
Basic usage
See component page for more details.
Regular expressions are executed against the entire input string. Therefore, it is
important to use ^
and $
as necessary to ensure that the entire string conforms
to the desired restrictions.
Example
<input is="iron-input" bind-value="{{value1}}" validator="alphanumeric-validator">
<plastik-regex-validator regex="/^[a-z0-9]$/i" validator-name="alphanumeric-validator">
</plastik-regex-validator>
<input is="iron-input" bind-value="{{value2}}" validator="zip-validator">
<plastik-regex-validator regex="/^\d{5,6}(?:[-\s]\d{4})?$/" validator-name="zip-validator">
</plastik-regex-validator>