Auto commit for build : 78
commit by: Administrator <gitlab_admin_873017@example.com> with message : redeploy cvs
This commit is contained in:
commit
d457ecde1f
|
@ -0,0 +1,53 @@
|
||||||
|
## 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 |
|
|
@ -0,0 +1,58 @@
|
||||||
|
declare const alphabetique: RegExp;
|
||||||
|
declare const email: RegExp;
|
||||||
|
declare const alpha: RegExp;
|
||||||
|
declare const num: RegExp;
|
||||||
|
declare const alphanum: RegExp;
|
||||||
|
declare const url: RegExp;
|
||||||
|
declare const ipAddress: RegExp;
|
||||||
|
declare const phone: RegExp;
|
||||||
|
declare const codePost: RegExp;
|
||||||
|
declare const time: RegExp;
|
||||||
|
declare const date: RegExp;
|
||||||
|
declare const tva: RegExp;
|
||||||
|
declare const price: RegExp;
|
||||||
|
|
||||||
|
|
||||||
|
declare const numMask: RegExp;
|
||||||
|
declare const alphaMask: RegExp;
|
||||||
|
declare const alphanumMask: RegExp;
|
||||||
|
declare const emailMask: RegExp;
|
||||||
|
declare const urlMask: RegExp;
|
||||||
|
declare const ipAddressMask: RegExp;
|
||||||
|
declare const prix: RegExp;
|
||||||
|
declare const password: RegExp;
|
||||||
|
declare const motDePasse: RegExp;
|
||||||
|
declare const matricule: RegExp;
|
||||||
|
declare const tvaIntercom: RegExp;
|
||||||
|
declare const iban: RegExp;
|
||||||
|
declare const city: RegExp;
|
||||||
|
declare const missiontitle: RegExp;
|
||||||
|
export {
|
||||||
|
// regexs
|
||||||
|
email,
|
||||||
|
alpha,
|
||||||
|
num,
|
||||||
|
alphanum,
|
||||||
|
url,
|
||||||
|
ipAddress,
|
||||||
|
date,
|
||||||
|
time,
|
||||||
|
tva,
|
||||||
|
price,
|
||||||
|
prix,
|
||||||
|
alphabetique,
|
||||||
|
password,
|
||||||
|
motDePasse,
|
||||||
|
matricule,
|
||||||
|
tvaIntercom,
|
||||||
|
iban,
|
||||||
|
//masks
|
||||||
|
numMask,
|
||||||
|
alphaMask,
|
||||||
|
alphanumMask,
|
||||||
|
emailMask,
|
||||||
|
urlMask,
|
||||||
|
ipAddressMask,
|
||||||
|
city,
|
||||||
|
missiontitle
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
|
||||||
|
"num": /^[0-9]+$/,
|
||||||
|
"numeric": /^[0-9]+$/,
|
||||||
|
"alpha": /^[a-zA-Z_]+$/,
|
||||||
|
"alphabetic": /^[a-zA-Z_]+$/,
|
||||||
|
"alphabetique":/^[A-Za-z\s\u00C0-\u00FF]+$/,
|
||||||
|
"alphanum": /^[a-zA-Z0-9_]+$/,
|
||||||
|
"alphanumeric": /^[a-zA-Z0-9_]+$/,
|
||||||
|
"email": /^(")?(?:[^\."\s])(?:(?:[\.])?(?:[\w\-!#$%&'*+/=?^_`{|}~]))*\1@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/,
|
||||||
|
"url": /(((^https?)|(^ftp)):\/\/((([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*)|(localhost|LOCALHOST))\/?)/i,
|
||||||
|
"ipAddress": /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
||||||
|
"phone": /^(?:(?:\+|00)33|0)\s*[1-9](?:\d{2}){4}$/,
|
||||||
|
"codePost": /^(((?!(96|97|98|99|00)))[0-9]{5})$|(2A|2B|2a|2b)[0-9]{3}$|(971|972|973|974|975|976)[0-9]{2}$/,
|
||||||
|
"codePostal": /^(((?!(96|97|98|99|00)))[0-9]{5})$|(2A|2B|2a|2b)[0-9]{3}$|(971|972|973|974|975|976)[0-9]{2}$/,
|
||||||
|
"time": /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/,
|
||||||
|
"price": /^\d+(\.\d{1,2})?$/,
|
||||||
|
"prix": /^\d+(\.\d{1,2})?$/,
|
||||||
|
"date": /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/,
|
||||||
|
"tva": /^(5\.5|10|20)$/,
|
||||||
|
// "password": /(?=^.{8,}$)(?=.*\d)(?=.*[!@#$%^&*]+)(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
|
||||||
|
|
||||||
|
"password": /^(?=.*[A-Z])(?=.*[-!#$@%&'’*+/=?^_`{|}~])(?=.*[0-9])(?=.*[a-z]).{8,}$/,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"motDePasse": /(?=^.{8,}$)(?=.*\d)(?=.*[!@#$%^&*]+)(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
|
||||||
|
"matricule": /[A-HJ-NP-TV-Z]{2}[\s-]{0,1}[0-9]{3}[\s-]{0,1}[A-HJ-NP-TV-Z]{2}|[0-9]{2,4}[\s-]{0,1}[A-Z]{1,3}[\s-]{0,1}[0-9]{2}/,
|
||||||
|
// "matricule": /(^\d{1,4}[A-Za-z]{1,4}\d{1,2}$)|(^[A-Za-z]{1,2}\s*\d{1,3}\s*[A-Za-z]{1,2})|(^\d{1,4}-[A-Za-z]{1,4}-\d{1,2}$)|(^[A-Za-z]{1,2}-\s*\d{1,3}-\s*[A-Za-z]{1,2})$/,
|
||||||
|
"tvaIntercom": /^(FR)([0-9]{11}$)/,
|
||||||
|
"iban": /^FR\d{12}[A-Z0-9]{11}\d{2}$/,
|
||||||
|
"secuNum": /^[0-9]{15}$/,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///special My intranet
|
||||||
|
'city' : /^[a-zA-Z \-'’áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*$/,
|
||||||
|
"missiontitle": /^[a-zA-Z \-'’áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*$/,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"timeMask": /[\d\s:amp]/i,
|
||||||
|
'numMask': /[0-9]/i,
|
||||||
|
'alphaMask': /[a-z_]/i,
|
||||||
|
'alphanumMask': /[a-z0-9_]/i,
|
||||||
|
'emailMask': /[\w.\-@'"!#$%&'*+/=?^_`{|}~]/i,
|
||||||
|
'urlMask': /[a-z0-9_]/i,
|
||||||
|
'ipAddressMask': /[\d\.]/i,
|
||||||
|
"phoneMask": /[0-9\+]/i,
|
||||||
|
"codePostMask": /[0-9ABab]/i,
|
||||||
|
'passwordMask': /[\w.\-@'"!#$%&'*+/=?^_`{|}~]/i,
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "@d3v4pp/rex",
|
||||||
|
"version": "0.0.4",
|
||||||
|
"description": "a set of usefull regEx By D3v4pp",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test":"mocha tests"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.d.ts",
|
||||||
|
"index.js",
|
||||||
|
"package.json",
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://cvs.d3v4pp.fr/D3V4PP/Rex.git"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name" : "Ayoub Hassani <D3v4pp>",
|
||||||
|
"email" : "ayoub@d3v4pp.fr",
|
||||||
|
"url" : "https://d3v4pp.fr/"
|
||||||
|
},
|
||||||
|
"funding": "https://paypal.me/SupportTheDoc",
|
||||||
|
"homepage": "https://cvs.d3v4pp.fr/D3V4PP/Rex/src/master/README.md",
|
||||||
|
"bugs": {
|
||||||
|
"url" : "https://cvs.d3v4pp.fr/D3V4PP/Rex/issues",
|
||||||
|
"email" : "ayoub@d3v4pp.fr"
|
||||||
|
},
|
||||||
|
"keywords": ["regex","validation"],
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "^9.0.1"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue