[Tutor] Using Regex to produce text

Luke Paireepinart rabidpoobear at gmail.com
Wed Apr 28 08:51:43 CEST 2010


On Wed, Apr 28, 2010 at 1:27 AM,  <mhw at doctors.net.uk> wrote:
> Dear All,
>
> Quick question:
>
> Is there an way of using the regex patterns to produce text, instead of matching it?
>
> E.g.:
> pat = re.compile("ab?d")
> pat.getListofPossibleText()
>

There's no end to the length of many patterns so this would be fairly pointless.
For example, what would getListofPossibleText do for the pattern ".*" ?

I think the better question is: what are you trying to do?
Or perhaps: Why do you think you need to solve your problem this way?

-Luke


More information about the Tutor mailing list