Hacker GitHub

← All repos

compose-regexp/compose-regexp.js

View on GitHub ↗ ★ 150 JavaScript

Build and compose maintainable regular expressions in JavaScript.

10 mentions on Hacker News by 1 person: 1 story, 9 comments · first 2016-05-15 · latest 2023-03-28

Mentions per year 10 mentions · busiest year 2022 (3)
20082026
  1. For JS/TS, I’ll add https://github.com/compose-regexp/compose-regexp.js to that list.
  2. With https://github.com/compose-regexp/compose-regexp.js you can have your cake and eat it too. It's a JS RegExp builder with a parser combinator API.
  3. …ported to JS: https://flems.io/#0=N4IgtglgJlA2CmIBcBWAzAOgAwCYA0IAzgMYBOA9... Here's the lib: https://github.com/compose-regexp/compose-regexp.js
  4. …lib that adds support for RegExp composition, set opperations, atomic groups and arbitrary bounds. https://github.com/compose-regexp/compose-regexp.js
  5. ▲ 6
    Show HN: Compose-regexp.js Build readable and maintainable RegExps. ReDOS begone
    story by pygy_ · 2022-05-04 · 1 comment
  6. Mostly, yes. They can be applied with a different formalism though. See https://github.com/pygy/compose-regexp.js which uses a parser combinator API with regexps as backend.
  7. https://github.com/pygy/compose-regexp.js is another option (800 bytes mingzipped): const {sequence, suffix} = composeRegexp; const maybe = suffix("?"); const oneOrMore = suffix("+"); const urlMatcher = sequence( /^/, "http" maybe("s"),…
  8. …So this allows one to create regexps piece by piece, to write tests for the sub-expressions, etc... https://github.com/pygy/compose-regexp.js
  9. https://github.com/pygy/compose-regexp.js ^^^ Regexp combinators in JS. 614 bytes minimized and gzipped. Once you're proficient with the standard RegExp syntax, you can write pretty complex ones without external tools, but when the times…
    comment by pygy_ · 2016-08-30 · in SRL – Simple Regex Language
  10. I made a JS lib just for that: https://github.com/pygy/compose-regexp.js Edit: real life example, a minimal lexer used to split compound CSS selectors on comas. We must skip those in strings, comments and in `:not(a, b)` pseudo-classes, so…