"Invert" regular expression matching

Martin Krallinger martink at cnb.uam.es
Tue Jun 17 13:21:26 CEST 2003


Dear all,

I would be pleased  if anyone has allready developed a python
program / module to "invert" regular expressions.

What I mean is a to extract from a given 
regular expression like (using e.g.: "(", ")",
"?" "|", "\S+" and " "):

, (which )?(is )?required (for|to|in)

into all the possible sentence fragments which 
can be extracted from the regular extression,

like :

, which is required for
, is required for
, which is required in
etc,.........

Note that within the regular expressions "." or "*"
do NOT appear, otherwise the number of combinations
could be almost unlimited,...

Thanks for any help/suggestions you could
provide me,

Martin




More information about the Python-list mailing list