1.0.4 • Published 8 years ago

ws-regex v1.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

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