"Invert" regular expression matching 
Author Message
 "Invert" regular expression matching

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



Sat, 03 Dec 2005 19:21:26 GMT  
 "Invert" regular expression matching
Quoth Martin Krallinger:
Quote:
> I would be pleased  if anyone has allready developed a python
> program / module to "invert" regular expressions.
  [...]
> , (which )?(is )?required (for|to|in)
  [...]
> , which is required for
> , is required for
> , which is required in
> etc,.........

  [...]

I don't know of anything which does exactly that, but you might be
able to adapt Jeff Epler's Novelwriting tool to your purposes:
    <http://unpythonic.net/~jepler/novelwriting/index.html>
(It generates random text matching a user-specified grammar.)

--

Every public frenzy produces legislation purporting to address it.
                                                  (Kinsley's Law)



Sun, 04 Dec 2005 23:38:47 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Regular Expression Pattern Matching "State" Object

2. "Regular Expression?"

3. Replace with regular expressions "except if..."

4. iss-matching - the free Regular Expression / Pattern Matching cluster

5. Regular expression problem: "|" interferring with ".*?"

6. Match "ab" in "abc", but not in "abd"

7. regular expression matching in J ? (or APL)

8. Regular Expression to match HTML elements

9. regular expression: matching ( )

10. Regular expression matching with Halstenbach's REGEXP

11. Regular Expression for Match Pattern (string) Function

12. Bug in regular expression pattern matching?

 

 
Powered by phpBB® Forum Software