Ben Last <b...@benlast.com> writes: > Good points. I wanted to find a syntax that allows comments as well as > being fluent: > RE() > .any_number_of.digits # Recall that any_number_of includes zero > .followed_by.an_optional.dot.then.at_least_one.digit # The dot is > specifically optional > # but we must have one digit as a minimum > .as_string()
Speaking of syntax, have you looked at pyparsing? I like their pattern-matching syntax, and I can see it being applied to regexes. They use an operator-heavy syntax, like: '(' + digits * 3 + ')-' + digits * 3 + '-' + digits * 4 That seems easier for me to read than the foo.then.follow syntax. That then makes me think of ometa, which is a fun read, but probably not completely relevant. Regards, Johann -- http://mail.python.org/mailman/listinfo/python-list