Den Mon, 16 Apr 2007 11:50:40 +0200 skrev Thomas Dybdahl Ahle: > Hi, I'm writing a program with a large data stream to which modules can > connect using regular expressions. > > Now I'd like to not have to test all expressions every time I get a > line, as most of the time, one of them having a match means none of the > others can have so. > > But ofcource there are also cases where a regular expression can > "contain" another expression, like in: "^strange line (\w+) and (\w+)$" > and "^strange line (\w+) (?:.*?)$" in which case I'd like to first test > the seccond and only if it mathces test the seccond. > > Do anybody know if such a test is possible? if exp0.contains(exp1): ...
I found this link: http://terpstra.ca/compare.html which seams to compare expressions. Not python expressions though. Sadly it writes nothing about the way it does the thing, and if it will always work. -- http://mail.python.org/mailman/listinfo/python-list