Show HN: Compose-regexp.js Build readable and maintainable RegExps. ReDOS begone https://ift.tt/rNLEwCY

Show HN: Compose-regexp.js Build readable and maintainable RegExps. ReDOS begone This is an old lib I just rejuvenated, adding support for Unicode RegExps, properly handling back-references, and taking advantage of these to create helpers that turn things that are usually too impractical to use into usable techniques. It lets you write anything you'd write with normal RegExps, but with a more readable syntax, and it lets you compose sub-expressions into larger patterns. It also provides helpers like: - `atomic()` that prevents the engine from backtracking into what you passed as argument. No more ReDOS. - `bound()` works like `\b` but for arbitrary character sets. E.g. `bound(/[_\p{L}\p{Number}]/u)` is a Unicode-aware `\b` - Set operations on character classes: `charSet.intersection(/\p{Lowercase}/u, /\p{Script=Greek}/u)` will only match lower case greek letters I hope you'll find it useful! https://ift.tt/tMckZ83 May 4, 2022 at 11:07PM

Komentar

Postingan populer dari blog ini

Show HN: Interactive exercises for GNU grep, sed and awk https://ift.tt/OxeFwah

Show HN: Create demos & guides just with a simple prompt https://ift.tt/HfWo3mz