Re: grimace: a fluent regular expression generator in Python

2013-07-17 Thread Ben Last
On 16 July 2013 20:48, python-list-requ...@python.org wrote: From: Anders J. Munch 2...@jmunch.dk Date: Tue, 16 Jul 2013 13:38:35 +0200 Ben Last wrote: north_american_number_re = (RE().start .literal('(').followed_by.**exactly(3).digits.then.**literal(')')

Re: grimace: a fluent regular expression generator in Python

2013-07-17 Thread Johann Hibschman
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

Re: grimace: a fluent regular expression generator in Python

2013-07-17 Thread Roy Smith
In article mailman.4772.1373978931.3114.python-l...@python.org, Anders J. Munch 2...@jmunch.dk wrote: The problem with Perl-style regexp notation isn't so much that it's terse - it's that the syntax is irregular (sic) and doesn't follow modern principles for lexical structure in computer

Re: grimace: a fluent regular expression generator in Python

2013-07-17 Thread Gregory Ewing
Ben Last wrote: north_american_number_re = (RE().start .literal('(').followed_by.__exactly(3).digits.then.__literal(')') .then.one.literal(-).then.__exactly(3).digits .then.one.dash.followed_by.__exactly(4).digits.then.end

Re: grimace: a fluent regular expression generator in Python

2013-07-16 Thread Joshua Landau
On 15 July 2013 23:21, Ben Last benl...@gmail.com wrote: Hi all I'd be interested in comments on a fluent regular expression generator I've been playing with (inspired by the frustrations of a friend of mine who's learning). The general use case is to be able to construct RE strings such

Re: grimace: a fluent regular expression generator in Python

2013-07-16 Thread Anders J. Munch
Ben Last wrote: north_american_number_re = (RE().start .literal('(').followed_by.exactly(3).digits.then.literal(')') .then.one.literal(-).then.exactly(3).digits .then.one.dash.followed_by.exactly(4).digits.then.end