rex/README.md

54 lines
2.4 KiB
Markdown

## what is `@d3v4pp/rex`
`d3v4pp/rex` is an [npm package](https://www.npmjs.com/package/@d3v4pp/rex) that contains a set of regular expressions, and that's it.
## installation & Usage
#### Current version
```
npm i @d3v4pp/rex --save
```
#### Next version
```
npm i git+https://cvs.d3v4pp.fr/D3V4PP/rex.git --save
```
#### How to use
```javascript
const { email, alpha, num } = require("@d3v4pp/rex");
email.test("email@example.com") //will return true
alpha.test("2233er") //will return false
num.test("1234") //will return true
```
## Included Regular expressions
| Regex | Description |
| :---------: | :------------------------------------------------------------------: |
| num | numeric only |
| alpha | only chars no numbers no special chars |
| alphanum | chars alphabet and numbers |
| email | a valid email |
| url | a valid url |
| ipAddress | ip addr v4 |
| password | complex password with special char, numeric uppercase and lowwercase |
| phone | french phone number |
| codePost | french zip code |
| time | time hh:mm:ss |
| price | float with a precision of two |
| date | french date dd/mm/YYYY |
| tva | french TVA, Set of values 5.5, 10 and 20 |
| prix | float with a precision of two |
| date | Fr date jj/mm/yyyy |
| password | complex password |
| motDePasse | complex password |
| matricule | european immatriculation |
| tvaIntercom | French TVA intra communautaire |
| iban | french IBAN |