ws-regex
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

ws-regex

a types/names-kv-pairs regex helper for typescript

npm install ws-regex --save

1.create regex and matches in map with keys tuple

const reg = Regex.Create(/function (.+?)\(.+/i);
const result = reg.Matches('function ABCDEF(value){...}', ['FNCM']);
const func_name = result['FNCM'];

2.set keys firstly

const reg = Regex.Create(/function (.+?)\(.+/i).SetKeys('FNCM');
const result = reg.Matches('function ABCDEF(value){...}');
const func_name = result['FNCM'];

3.use index instead of keys

const reg = Regex.Create(/function (.+?)\(.+/i);
const result = reg.Matches('function ABCDEF(value){...}');
const func_name = result[1];

4.static types of regex type and string-pattern

const reg = Regex.Create('function (.+?)\\(.+', RegexType.IgnoreCase);
const result = reg.Matches('function ABCDEF(value){...}');
const func_name = result[1];

the types is ...[] styles, supports more type inputs.

support as es5 mode

Readme

Keywords

none

Package Sidebar

Install

npm i ws-regex

Weekly Downloads

8

Version

1.0.4

License

MIT

Last publish

Collaborators

  • migician