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.
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.