in reply to generating strings from a regular expression

In general, no: /a+/ generates the language (a, aa, aaa, ...) and is infinite in size. For regexes that generate a finite language, one proven method is to test all possible strings up to a chosen length to see if they match the regex. But that is slow.

Another approach is rewrite the regex as a BNF-style grammar. One can then parse the grammar into a tree and walk all possible paths in this tree. This will generally be faster than the exhaustive method.

-Mark
  • Comment on Re: generating strings from a regular expression