Skip to content

jannicz/regex-validators

Repository files navigation

JavaScript-Regex-Validators

See Validator Demo and Examples

Setup

Include the validation script and the validator functions

<script src="validation.js"></script>
<script src="regex-validators.js"></script>

Usage

Crete a div containing div class="errors and a sibling input field and attach a data-validate="validationFunctionName" to each input field

<div class="form-control">	
  <ul class="errors">
    <li>contains at least one alphabetic character</li>
    <li>contains at least one digit or a non-alphabetic character</li>
  </ul>
  <input type="text" data-validate="isPasswordComplex">
</div>

Usage examples

Can be used for frontend validation of following input fields:

Numbers

  • digital place separator
  • valid date
  • maximum/minimum date
  • valid time

Strings

  • username characters
  • password characters
  • password complexity
  • email validity

About

Form Validation lib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published