diff --git a/lib/node_modules/@stdlib/regexp/regexp/lib/main.js b/lib/node_modules/@stdlib/regexp/regexp/lib/main.js index bced5abb1d06..7911324f4f66 100644 --- a/lib/node_modules/@stdlib/regexp/regexp/lib/main.js +++ b/lib/node_modules/@stdlib/regexp/regexp/lib/main.js @@ -35,7 +35,7 @@ * // returns false */ function reRegExp() { - return /^\/((?:\\\/|[^\/])+)\/([imgy]*)$/; // eslint-disable-line no-useless-escape + return /^\/((?:\\\/|[^\/])+)\/([dgimsuvy]*)$/; // eslint-disable-line no-useless-escape } diff --git a/lib/node_modules/@stdlib/regexp/regexp/lib/regexp.js b/lib/node_modules/@stdlib/regexp/regexp/lib/regexp.js index ab4e0329e5b2..3cde761c629f 100644 --- a/lib/node_modules/@stdlib/regexp/regexp/lib/regexp.js +++ b/lib/node_modules/@stdlib/regexp/regexp/lib/regexp.js @@ -28,7 +28,7 @@ var reRegExp = require( './main.js' ); /** * Matches parts of a regular expression string. * -* Regular expression: `/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/` +* Regular expression: `/^\/((?:\\\/|[^\/])+)\/([dgimsuvy]*)$/` * * - `/^\/` * - match a string that begins with a `/` @@ -51,15 +51,15 @@ var reRegExp = require( './main.js' ); * - `\/` * - match the literal `/` * -* - `([imgy]*)` -* - capture any characters matching `imgy` occurring zero or more times +* - `([dgimsuvy]*)` +* - capture any characters matching `dgimsuvy` occurring zero or more times * * - `$/` * - string end * * @constant * @type {RegExp} -* @default /^\/((?:\\\/|[^\/])+)\/([imgy]*)$/ +* @default /^\/((?:\\\/|[^\/])+)\/([dgimsuvy]*)$/ */ var RE_REGEXP = reRegExp(); diff --git a/lib/node_modules/@stdlib/regexp/regexp/test/test.main.js b/lib/node_modules/@stdlib/regexp/regexp/test/test.main.js index 0d14af1cdaa1..54e3d62d2fbf 100644 --- a/lib/node_modules/@stdlib/regexp/regexp/test/test.main.js +++ b/lib/node_modules/@stdlib/regexp/regexp/test/test.main.js @@ -57,6 +57,28 @@ tape( 'the function returns a regular expression that detects a regular expressi t.end(); }); +tape( 'the function returns a regular expression that detects a regular expression string having any supported flag', function test( t ) { + var values; + var RE; + var i; + + RE = reRegExp(); + + values = [ + '/beep/d', + '/beep/s', + '/beep/u', + '/beep/v', + '/beep/gimsuy', + '/beep/dgimsy' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( RE.test( values[i] ), true, values[i] ); + } + t.end(); +}); + tape( 'the function returns a regular expression that detects a non-regular expression string', function test( t ) { var values; var RE; diff --git a/lib/node_modules/@stdlib/regexp/regexp/test/test.regexp.js b/lib/node_modules/@stdlib/regexp/regexp/test/test.regexp.js index d7bf0d93eacf..b8df235099b6 100644 --- a/lib/node_modules/@stdlib/regexp/regexp/test/test.regexp.js +++ b/lib/node_modules/@stdlib/regexp/regexp/test/test.regexp.js @@ -54,6 +54,25 @@ tape( 'the regular expression detects a regular expression string', function tes t.end(); }); +tape( 'the regular expression detects a regular expression string having any supported flag', function test( t ) { + var values; + var i; + + values = [ + '/beep/d', + '/beep/s', + '/beep/u', + '/beep/v', + '/beep/gimsuy', + '/beep/dgimsy' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( RE.test( values[i] ), true, values[i] ); + } + t.end(); +}); + tape( 'the regular expression detects a non-regular expression string', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/utils/regexp-from-string/test/test.js b/lib/node_modules/@stdlib/utils/regexp-from-string/test/test.js index 8c1a0fe1b723..e309e0966440 100644 --- a/lib/node_modules/@stdlib/utils/regexp-from-string/test/test.js +++ b/lib/node_modules/@stdlib/utils/regexp-from-string/test/test.js @@ -93,6 +93,28 @@ tape( 'the function returns a regular expression', function test( t ) { t.end(); }); +tape( 'the function returns a regular expression having any flag supported by the environment', function test( t ) { + var expected; + var actual; + var flags; + var i; + + flags = [ 'd', 'g', 'i', 'm', 's', 'u', 'v', 'y' ]; + for ( i = 0; i < flags.length; i++ ) { + expected = null; + try { + expected = new RegExp( 'beep', flags[ i ] ); + } catch ( err ) { // eslint-disable-line no-unused-vars + // The environment does not support the flag... + } + if ( expected ) { + actual = reFromString( '/beep/' + flags[ i ] ); + t.strictEqual( actual.toString(), expected.toString(), flags[ i ] ); + } + } + t.end(); +}); + tape( 'the function returns `null` if unable to parse an input string as a regular expression', function test( t ) { var values; var i;