in reply to generating strings from a regular expression

While it is not exactly what you are looking for, you might want to check out Grail+ which has tools to do something very close to what you are asking.

As was pointed out already it is not possible to generate an exhaustive list. It should be possible, though, to generate the shortest strings to match a particular RE within reason. Clearly /a.b/ matches a<any single char>b so there are lots of possibilities. I seem to recall using such a tool years ago, but cannot find it now. However you can check out AAAAA which generates short and long strings. Unfortunately, I do not think it uses Perl REs...

Oh, and don't confuse the re "a" which matches a single 'a' with the perl m/a/ which will match "any" string with an 'a' in it.

HTH, --traveler

  • Comment on Re: generating strings from a regular expression