Skip to content

Commit

Permalink
Merge pull request #9 from michaeldera/optional-global-flag
Browse files Browse the repository at this point in the history
remove global flag
  • Loading branch information
michaeldera authored Jul 10, 2020
2 parents 5726bd0 + 9b9081a commit 24ad259
Show file tree
Hide file tree
Showing 8 changed files with 978 additions and 3,850 deletions.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
961 changes: 961 additions & 0 deletions .vs/simple-regex-ts/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added .vs/slnx.sqlite
Binary file not shown.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ To test a variable against a Regex expression:
You can also inject the Regex Pattern into HTML form fields. An example of this pattern in ReactJS
`<input type="text" name="number_plate" pattern={SimpleRegex.NumberPlate} title="Zimbabwean Number Plate">`

### Global Flag
Starting from version 2.0.0-alpha the package no longer has the global flag set by default. See [an issue about it here](https://github.com/michaeldera/simple-regex-ts/issues/8)

### Available Patterns

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-regex",
"version": "1.1.3",
"version": "2.0.0-alpha.1",
"description": "A simple library with common Zimbabwean regex patterns",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -23,7 +23,8 @@
"keywords": [
"Regex",
"Zimbabwe",
"Validation"
"Validation",
"SimpleRegex"
],
"author": "Michael Dera",
"license": "MIT",
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const TestMobileNumber = (mobileNumber: string): boolean => {

export const EmailAddress = RegExp('^[a-zA-Z0-9.!#$%&’+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)$');
export const MobileNumber = {
Econet: RegExp(/^(((\+)*263)|0)7(7|8)[0-9]{7}$/gm),
Netone: RegExp(/^(((\+)*263)|0)71[0-9]{7}$/gm),
Telecel: RegExp(/^(((\+)*263)|0)73[0-9]{7}$/gm),
Econet: RegExp(/^(((\+)*263)|0)7(7|8)[0-9]{7}$/),
Netone: RegExp(/^(((\+)*263)|0)71[0-9]{7}$/),
Telecel: RegExp(/^(((\+)*263)|0)73[0-9]{7}$/),
test: TestMobileNumber
};
export const NationalID = RegExp(/^[0-9]{2}(-|s)[0-9]{6,7}s*[A-Z]s*[0-9]{2}$/gm);
export const NationalID = RegExp(/^[0-9]{2}(-|s)[0-9]{6,7}s*[A-Z]s*[0-9]{2}$/);
export const NumberPlate = RegExp(/^[A-Z]{3}(-|[[:blank:]])[0-9]{3}$/gm);
export const PassportNumber = RegExp(/^[A-Z]{2}[0-9]{6}$/gm);
export const DriversLicence = RegExp(/^\b\d{5}[a-zA-Z]{2}\b/gm);
export const SSN = RegExp(/^\b([0-9]){7}([a-zA-Z]){1}\b/gm);
export const PassportNumber = RegExp(/^[A-Z]{2}[0-9]{6}$/);
export const DriversLicence = RegExp(/^\b\d{5}[a-zA-Z]{2}\b/);
export const SSN = RegExp(/^\b([0-9]){7}([a-zA-Z]){1}\b/);

export const SimpleRegex = {
/**
Expand Down
Loading

0 comments on commit 24ad259

Please sign in to comment.