3 ms·
It's been a while since I read the book, and I don't remember this use of regexes; but is it by chance covered under Ovid's HOP::Parser module (http://search.cp
by JadeNB 16y ago
It's been a while since I read the book, and I don't remember this use of regexes; but is it by chance covered under Ovid's HOP::Parser module (http://search.cpan.org/~ovid/HOP-Parser http://search.cpan.org/~ovid/HOP-Parser), or another in that family (http://search.cpan.org/search?query=HOP http://search.cpan.org/search?query=HOP)?
- mjd 16y agoIt's section 6.5, "Regex string generation". Page 272: "Given a regex, how can one generate a list of all the strings matched by the regex?"
- elblanco 16y agoI've been looking for such a beast in the wild for quite some time. I've seen a few on CPAN that'll take a regex (or some type of expression, or some limited dialect of regex) and spit out a few random strings. Even Microsoft's REX tool (http://research.microsoft.com/en-us/projects/rex/ http://research.microsoft.com/en-us/projects/rex/), which is the best I've seen, gives nondeterministic random results. Having a tool that would take a PCRE (or some subset of the language), apply some constraints on repetition operators (like *->{0,2}, +->{1,2}) etc., spit out a deterministic list of values (don't care how long so long as it's reasonably finite) would be extremely powerful for software testing. Even the rather limited capabilities in REX have helped me fix some invalid assumptions I was making about valid inputs. It's always seemed strange to me that regular expressions are described in the literature as string generators, yet I've pretty much only ever seen them used as string acceptors in practice in the form of a predicate (s in set <REGEX>?).