# regexp-support

> check RegExp ( regular expressions ) support

Latest version **2.0.0** (published 2026-11-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install regexp-support
pnpm add regexp-support
yarn add regexp-support
bun add regexp-support
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-11-14 |
| First published | 2018-04-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 532 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | bluelovers |
| Maintainers | bluelovers |
| Keywords | check, es2018, esnext, flag, flags, is, pattern, property, proto, prototype, re, regex, regexp, regular expression, static, support, supported, unicode, valid |

## Links

- npm: https://www.npmjs.com/package/regexp-support
- Repository: https://github.com/bluelovers/ws-regexp
- Homepage: https://github.com/bluelovers/ws-regexp/tree/master/packages/regexp-support#readme
- Issues: https://github.com/bluelovers/ws-regexp/issues
- npm.io page: https://npm.io/package/regexp-support

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) >=2
- [@regexp-cjk/types](https://npm.io/package/@regexp-cjk/types.md) ^2.0.0
- [sort-object-keys2](https://npm.io/package/sort-object-keys2.md) ^3.0.10
- [array-hyper-unique](https://npm.io/package/array-hyper-unique.md) ^2.1.10

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-11-14
- 1.0.62 — 2026-09-06
- 1.0.61 — 2026-09-06
- 1.0.60 — 2026-09-06
- 1.0.59 — 2025-03-12
- 1.0.58 — 2024-09-03
- 1.0.57 — 2024-09-02
- 1.0.55 — 2024-08-24
- 1.0.54 — 2024-03-01
- 1.0.53 — 2024-01-29
- 1.0.52 — 2023-02-28
- 1.0.47 — 2022-10-16
- 1.0.46 — 2022-02-04
- 1.0.43 — 2021-12-08
- 1.0.41 — 2021-11-14
- … 31 more at https://npm.io/package/regexp-support/versions

## README

# regexp-support

    check RegExp ( regular expressions ) support

## install

```bash
# 使用 yarn / Using yarn
yarn add regexp-support

# 使用 yarn-tool / Using yarn-tool
yarn-tool add regexp-support
# yt 是 yarn-tool 的別名 / yt is an alias for yarn-tool
yt add regexp-support

# 使用 pnpm / Using pnpm
pnpm add regexp-support

# 使用 npm / Using npm
npm install regexp-support
```

[version test log](test/log)

## Api

allow u check support on other RegExp base class

```ts
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`

```ts
export interface ICreateRegExp
{
	create(pattern: string, flag?: string, ...argv)
}
```

## demo

```ts
import support from 'regexp-support';

console.log(support);
```

## todo

* need more test on unicode set [unicode.ts](lib/pattern/charset/unicode.ts) , [unicode-script.ts](lib/pattern/charset/unicode-script.ts)

### desc

#### lookAheadPositive, lookAheadNegative

* `aa(?=bb)`
* `aa(?!bb)`

#### lookBehindPositive

* `(?<=\$)foo`

```ts
const RE_DOLLAR_PREFIX = /(?<=\$)foo/g;
'$foo %foo foo'.replace(RE_DOLLAR_PREFIX, 'bar'); // => '$bar %foo foo'
```

#### lookBehindNegative

* `(?<!\$)foo`

```ts
const RE_NO_DOLLAR_PREFIX = /(?<!\$)foo/g;
'$foo %foo foo'.replace(RE_NO_DOLLAR_PREFIX, 'bar'); // => '$foo %bar bar'
```

### node.js 10

```ts
{ 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,
     '$&': true,
     lastParen: true,
     '$+': true,
     leftContext: true,
     '$`': true,
     rightContext: true,
     '$\'': true,
     '$10': false,
     '$100': false },
  symbol: 
   { species: false,
     match: true,
     replace: true,
     search: true,
     split: true },
  objectStringTag: '[object RegExp]',
  unicodeSet: 
   { unicode: true,
     script: true,
     blocks: false,
     unicodeTest: 
      { C: true,
        Other: true,
        Cc: true,
        Control: true,
        Cs: true,
        Surrogate: true,
        L: true,
        Letter: true,
        LC: true,
        Cased_Letter: true,
        Ll: true,
        Lowercase_Letter: true,
        Lo: true,
        Other_Letter: true,
        Lu: true,
        Uppercase_Letter: true,
        M: true,
        Mark: true,
        Me: true,
        Enclosing_Mark: true,
        Mn: true,
        Nonspacing_Mark: true,
        N: true,
        Number: true,
        Nd: true,
        Decimal_Number: true,
        Nl: true,
        Letter_Number: true,
        No: true,
        Other_Number: true,
        P: true,
        Punctuation: true,
        Pc: true,
        Connector_Punctuation: true,
        Pd: true,
        Dash_Punctuation: true,
        Pe: true,
        Close_Punctuation: true,
        Pf: true,
        Final_Punctuation: true,
        Pi: true,
        Initial_Punctuation: true,
        Po: true,
        Other_Punctuation: true,
        Ps: true,
        Open_Punctuation: true,
        S: true,
        Symbol: true,
        Sc: true,
        Currency_Symbol: true,
        Sk: true,
        Modifier_Symbol: true,
        Sm: true,
        Math_Symbol: true,
        So: true,
        Other_Symbol: true,
        Z: true,
        Separator: true,
        Zl: true,
        Line_Separator: true,
        Zp: true,
        Paragraph_Separator: true,
        Zs: true,
        Space_Separator: true,
        ASCII: true,
        Alphabetic: true,
        Any: true,
        White_Space: true,
        Alpha: true,
        Emoji: true,
        Emoji_Component: true,
        Emoji_Modifier: true,
        Emoji_Presentation: true,
        Ideographic: true,
        Ideo: true,
        Lower: true,
        Quotation_Mark: true,
        QMark: true,
        Unified_Ideograph: true,
        Upper: true,
        Combining_Mark: true,
        punct: true,
        Digit: false,
        Alnum: false,
        Punct: false,
        Graph: false,
        Blank: false,
        Cntrl: false,
        XDigit: false,
        Space: false,
        Decimal_Digit_Number: false },
     scriptTest: 
      { Arabic: true,
        Bengali: true,
        Common: true,
        Coptic: true,
        Cyrillic: true,
        Ethiopic: true,
        Georgian: true,
        Greek: true,
        Han: true,
        Hangul: true,
        Hiragana: true,
        Katakana: true,
        Latin: true,
        Tamil: true,
        Tibetan: true,
        Arab: true,
        Beng: true,
        Copt: true,
        Cyrl: true,
        Ethi: true,
        Geor: true,
        Grek: true,
        Hani: true,
        Hira: true,
        Kana: true,
        Latn: true,
        Taml: true,
        Tibt: true },
     blocksTest: { InBasic_Latin: false } } }
```

### node.js 9

> by test on RunKit

```ts
{ 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: false,
     namedCapturingGroupsUnicode: false,
     namedCapturingGroupsEmoji: false } }
```

### node.js 8

> by test on RunKit

```ts
{ 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: false,
     namedCapturingGroupsUnicode: false,
     namedCapturingGroupsEmoji: false } }
```

## link

* http://2ality.com/archive.html?tag=regexp
* http://2ality.com/2017/07/regexp-unicode-property-escapes.html
* https://en.wikipedia.org/wiki/Unicode_character_property
* http://www.wellho.net/regex/javare.html
* https://zhuanlan.zhihu.com/p/33335629
* https://github.com/Icemic/huozi.js/blob/master/lib/isCJK.js
* https://github.com/ethantw/Han/blob/master/src/js/regex/unicode.js
* https://github.com/tc39/proposal-regexp-unicode-property-escapes#why-not-support-the-name-property-pname
* https://stackoverflow.com/questions/6493954/how-to-properly-write-regex-for-unicode-first-name-in-java

---
_Source: https://npm.io/package/regexp-support · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
