News for hackers. Stuff that matters.
Re:Show HN: my regular expression example match generator by kenjackson on Friday September 24, 2010 @05:59PM (#1725579)
In grad school I had a need for a tool that would generate all strings accepted by a regex of a specified size.

I wrote one myself, but was never really satisfied that I did a good job on it. I'd love to see the code of an efficient implementation of such a thing.

Re:Show HN: my regular expression example match generator by abecedarius on Friday September 24, 2010 @06:58PM (#1725715)
Re:Show HN: my regular expression example match generator by kenjackson on Friday September 24, 2010 @08:07PM (#1725873)
Thank you. That is actually an excellent paper. A decade late for me, but excellent.
Re:Show HN: my regular expression example match generator by rndmcnlly0 on Friday September 24, 2010 @06:12PM (#1725626)
"Generate all" and "efficient" seems doomed at some level. Considering /[01]+/, there are clearly an exponential number of matches given some given max length.

The expression itself provides a nice summary of the generative space it implies. Perhaps for a particular application you could apply a kind of lazy generation. Say, given /[01]+/ it would first expand it into the subspaces of /0/, /1/, /0[01]+/, and /1[01]+/. One of these branches could be expanded next depending on what was actually needed in the next step.

Re:Show HN: my regular expression example match generator by elblanco on Saturday September 25, 2010 @12:41AM (#1726324)
"Higher Order Perl" has a chapter on building one in Perl. http://en.wikipedia.org/wiki/Higher-Order_Perl I believe the full text is available.