grimace: a fluent regular expression generator in Python

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Jul 17 19:51:34 EDT 2013


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
>                                              .as_string())

Is 'dash' the same as 'literal("-")'?

Is there any difference between 'then' and 'followed_by'?

Why do some things have __ in front of them? Is there a
difference between 'literal' and '__literal'?

-- 
Greg



More information about the Python-list mailing list