- Do you genuinely, truly believe that "4 digits then "-" then 2 digits then "-" then 2 digits" is more readable than "\d{4}-\d{2}-\d{2}"? Do you think your walls of text won't make everyone's eyes glaze over a few lines in? More importantly, do you believe it's more writable? A lot of regex operations are ad-hoc, and being able to type them out quickly and look at them in a small text field at a glance is very important. And as far as coding is concerned, well, your thing is useless outside of the JS ecosystem, is it not?
Dead? Replaced?... Your toy is cute, but it's more suited as a regex generator, or perhaps parser/"explainer" (but we already have several well-known projects there) than a standalone tool.
- The effort here is laudable, and this is cool! But your real competition isn't regexes, but parser combinator libraries. For cases where readability and matching matter, parser combinators are the go to. It's a bit difficult to see how this improves on that front.
- We built Match, a pattern matching language that compiles to WASM and replaces regex with readable grammars.
Instead of this: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
You write this:
email: username then "@" then domain
username: one or more of (letter, digit, ".", "_", "-")
domain: one or more of (letter, digit, "-") then "." then between 2 and 6 letters
Match features:
- WASM JIT + JS JIT: matches or beats native regex on most patterns
- Linear-time parsing, no backtracking, no ReDoS, ever
- Full parse trees with named extractions, not just match/no-match
- Zero dependencies, ~7KB, MIT licensed
- Composable grammars via modules
Website: https://matchlang.com
Performance: https://matchlang.com/docs/api/performance
- The preferred style here for the titles is more dry, something like "Matchlang: A pattern matching language that replaces regular expressions. Full parse trees, no ReDoS" or a shorter version like "Matchlang: A replacement for regular expressions. Full parse trees, no ReDoS".
If you write in the title "Regex is dead" people will get skeptical and ask for proofs.
- How about performance?
- Performance breakdown: https://matchlang.com/docs/api/benchmarks
- You didn't understand the query
How does yours compare to regexp on performance across many inputs?
Regexp is incredibly fast, I doubt yours comes anywhere close
and then there's the kicker, Ai are really good at crafting regexp, better than writing code to replace it, that's for sure
---
looks like the comment I am replying to has changed the link, it was this one: https://matchlang.com/docs/api/performance
Note to OP, use standard regexp benchmarks
- elaborate?
- Look at a fast regex library [1] and take a subset of those tests or benchmarks and apply to match.
[1] https://github.com/intel/hyperscan/tree/master
That could be a fun comparison. As someone mentioned, regular expressions are extremely fast, and have been benchmarked forever.