Tuesday, April 20, 2004

Python Cookbook: An xmple of scanning of parsing the ( and ) in a RE

Nice to combine with my own code! :))
"Very often we need to look for the occurence of words in a string or group of words. We rely on regular expressions for such operations. A very common requirement is to look for the occurence of certain words in a paragraph or string. We can group the occurence by boolean operators AND, OR and NOT, allowing to search for certain words using boolean logic.
This class is created to do exactly that. It wraps up a
complex boolean word expression, creating an internal
regular expression, and provides methods allowing you to
perform matches and searches on it."