README
regexp-support
check RegExp ( regular expressions ) support
install
npm install regexp-support
Api
allow u check support on other RegExp base class
hasSupportFlag(flag: string, RegExpClass?: typeof RegExp, skipPatternCheck?: boolean): boolean
testFlag(flag: string, RegExpClass?: typeof RegExp, flagsPattern?): boolean
RegExpClass
can be Object with create
, for some class can't create by new
export interface ICreateRegExp
{
create(pattern: string, flag?: string, ...argv)
}
demo
import support from 'regexp-support';
console.log(support);
todo
- need more test on unicode set unicode.ts , unicode-script.ts
desc
lookAheadPositive, lookAheadNegative
aa(?=bb)
aa(?!bb)
lookBehindPositive
(?<=\$)foo
const RE_DOLLAR_PREFIX = /(?<=\$)foo/g;
'$foo %foo foo'.replace(RE_DOLLAR_PREFIX, 'bar'); // => '$bar %foo foo'
lookBehindNegative
(?<!\$)foo
const RE_NO_DOLLAR_PREFIX = /(?<!\$)foo/g;
'$foo %foo foo'.replace(RE_NO_DOLLAR_PREFIX, 'bar'); // => '$foo %bar bar'
node.js 10
{ nativeFlags: 'gimsuy',
flags:
{ multiline: true,
m: true,
global: true,
g: true,
ignoreCase: true,
i: true,
sticky: true,
y: true,
unicode: true,
u: true,
dotAll: true,
s: true,
freeSpacing: false,
x: false,
n: false },
flagsAll: { g: true, i: true, m: true, s: true, u: true, y: true },
pattern:
{ namedCapturingGroups: true,
namedCapturingGroupsUnicode: true,
namedCapturingGroupsEmoji: false,
namedCapturingGroupsBackreference: true,
namedCapturingGroupsDuplicate: false,
lookAheadPositive: true,
lookAheadNegative: true,
lookBehindPositive: true,
lookBehindNegative: true,
dotUnicodeEmoji: true,
classSub: false },
prototype:
{ source: true,
flags: true,
lastIndex: true,
dotAll: true,
global: true,
ignoreCase: true,
multiline: true,
sticky: true,
unicode: true },
static:
{ '$1': true,
'$2': true,
'$3': true,
'$4': true,
'$5': true,
'$6': true,
'$7': true,
'$8': true,
'$9': true,
input: true,
'$_': true,
lastMatch: true,
'