3 ms·
A bit orthogonal but something I would love to see: A library which takes a regex and shows some examples that pass and some that fail. I would find that the e
by maximilianroos 5y ago
A bit orthogonal but something I would love to see:
A library which takes a regex and shows some examples that pass and some that fail. I would find that the easiest way of understanding a regex, rather than changing the language itself. (Though Melody looks v promising and I'm keen to see it develop).
It wouldn't be trivial to build — particularly for the "fail" examples, you'd want them fairly close to passing. For example, with `(/*\.csv\.gz)` you'd want `foo.csv.gz` rather than `aoseutn` as an example of a failure.
- nathancahill 5y agoLike American Fuzzy Lop for regex. I dig it.
- all2 5y agoThere's a python library called xeger [0] that allows you to generate strings from regular expressions. I've used this at work to generate large quantities of "valid" test data. [0] https://pypi.org/project/xeger/ https://pypi.org/project/xeger/
- dotancohen 5y agoThis looks great as a password generator, username generator, etc. Thank you!
- tgv 5y agoThe fail bit is harder indeed, especially for larger regexps, but not totally impossible. The easiest way towards that goal seems to be constructing the DFA first and then generating illegal single edits (insertion, deletion, substitution). Generating a positive example is possible without it.