Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50788
| From | Johann Hibschman <jhibschman@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: grimace: a fluent regular expression generator in Python |
| Date | 2013-07-17 07:55 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <xjrkgppuh73cm.fsf@gmail.com> (permalink) |
| References | <mailman.4800.1374059632.3114.python-list@python.org> |
Ben Last <ben@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: grimace: a fluent regular expression generator in Python Ben Last <ben@benlast.com> - 2013-07-17 10:33 +0800 Re: grimace: a fluent regular expression generator in Python Johann Hibschman <jhibschman@gmail.com> - 2013-07-17 07:55 -0500 Re: grimace: a fluent regular expression generator in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-07-18 11:51 +1200
csiph-web