1.1.3 • Published 6 years ago

common-regexes v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

common-regexes

A group of regexes commonly used in web-development. Can be used for both NodeJs and client-side JavaScript. Useful for creating uniformity between front-end and back-end development.

created by sean maxwell June 27, 2018

Methods

every method returns a boolean

  • regexes.email.test('example@example.com') <-- checks format "some_string"@"some_string"

  • regexes.password.test('Password@1') <-- Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character/

  • regexes.name.test('Sean Paul') <-- only letters and Spaces

  • regexes.jwt.test('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi 1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM') <-- JSON Web Token format

  • NodeJS example:

          import * as Regexes from 'common-regexes'
          
          let valid = Regexes.email.test('example@example.com') // valid => true
          
          
  • Angular example:

          import * as Regexes from 'common-regexes'
          
          Validators.pattern(Regexes.email) // email validator 
          
          
          
  • Browser example:

          <!DOCTYPE html>
          <html lang="en">
          
              <head>
                  <meta charset="UTF-8">
                  <title>Title</title>
          
                  <script type="text/javascript" src="../node_modules/common-regexes/index.min.js"></script>
                  <script>
                      let regexes = require('Regexes');
                      let valid = regexes.password.test('horseyMcFoo');
                      alert(valid); // valid => false
                  </script>
              </head>
          
              <body>
              </body>
          
          
          </html>
          
         
1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago