diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/git/index.ts | 2 | ||||
| -rw-r--r-- | src/modules/helpers/index.ts | 12 | ||||
| -rw-r--r-- | src/modules/internet/index.ts | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/git/index.ts b/src/modules/git/index.ts index f19abeef..6a48efc7 100644 --- a/src/modules/git/index.ts +++ b/src/modules/git/index.ts @@ -97,7 +97,7 @@ export class GitModule { const email = this.faker.internet.email({ firstName, lastName }); // Normalize user according to https://github.com/libgit2/libgit2/issues/5342 - user = user.replace(/^[\.,:;"\\']|[\<\>\n]|[\.,:;"\\']$/g, ''); + user = user.replace(/^[.,:;"\\']|[<>\n]|[.,:;"\\']$/g, ''); lines.push( `Author: ${user} <${email}>`, diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 7ace1e91..3cc9e855 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -99,9 +99,9 @@ function legacyRegexpStringParse( string: string = '' ): string { // Deal with range repeat `{min,max}` - const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/; + const RANGE_REP_REG = /(.)\{(\d+),(\d+)\}/; const REP_REG = /(.)\{(\d+)\}/; - const RANGE_REG = /\[(\d+)\-(\d+)\]/; + const RANGE_REG = /\[(\d+)-(\d+)\]/; let min: number; let max: number; let tmp: number; @@ -192,7 +192,7 @@ export class SimpleHelpersModule { .normalize('NFKD') //for example è decomposes to as e + ̀ .replace(/[\u0300-\u036f]/g, '') // removes combining marks .replace(/ /g, '-') // replaces spaces with hyphens - .replace(/[^\w\.\-]+/g, ''); // removes all non-word characters except for dots and hyphens + .replace(/[^\w.-]+/g, ''); // removes all non-word characters except for dots and hyphens } /** @@ -416,7 +416,7 @@ export class SimpleHelpersModule { // Deal with single wildcards const SINGLE_CHAR_REG = - /([.A-Za-z0-9])(?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/; + /([.A-Za-z0-9])(?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/; let token = pattern.match(SINGLE_CHAR_REG); while (token != null) { const quantifierMin: string = token[2]; @@ -439,7 +439,7 @@ export class SimpleHelpersModule { const SINGLE_RANGE_REG = /(\d-\d|\w-\w|\d|\w|[-!@#$&()`.+,/"])/; const RANGE_ALPHANUMEMRIC_REG = - /\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+)|)/; + /\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+)|)/; // Deal with character classes with quantifiers `[a-z0-9]{min[, max]}` token = pattern.match(RANGE_ALPHANUMEMRIC_REG); while (token != null) { @@ -548,7 +548,7 @@ export class SimpleHelpersModule { token = pattern.match(RANGE_ALPHANUMEMRIC_REG); } - const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/; + const RANGE_REP_REG = /(.)\{(\d+),(\d+)\}/; // Deal with quantifier ranges `{min,max}` token = pattern.match(RANGE_REP_REG); while (token != null) { diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts index 842ab153..6e8f822f 100644 --- a/src/modules/internet/index.ts +++ b/src/modules/internet/index.ts @@ -265,7 +265,7 @@ export class InternetModule { let localPart: string = this.userName({ firstName, lastName }); // Strip any special characters from the local part of the email address // This could happen if invalid chars are passed in manually in the firstName/lastName - localPart = localPart.replace(/[^A-Za-z0-9._+\-]+/g, ''); + localPart = localPart.replace(/[^A-Za-z0-9._+-]+/g, ''); // The local part of an email address is limited to 64 chars per RFC 3696 // We limit to 50 chars to be more realistic |
