Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83628

Re: Python 3 regex?

References <54B40C85.5000806@emerytelcom.com> <54B42502.6050702@gmail.com>
Date 2015-01-13 07:32 +1100
Subject Re: Python 3 regex?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.17637.1421094729.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Jan 13, 2015 at 6:48 AM, Ian <hobson42@gmail.com> wrote:
> My recommendation would be to write a recursive decent parser for your
> files.
>
> That way will be easier to write, much easier to modify and almost certainly
> faster that a RE solution - and it can easily give you all the information
> in the file thus future proofing it.

Generally, even a recursive descent parser will be overkill. It's
pretty easy to do simple string manipulation to get the info you want;
maybe that means restricting the syntax some, but for a personal-use
script, that's usually no big cost. The example I gave requires that
the indentation be correct, and on this mailing list, I think people
agree that that's not a deal-breaker :)

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python 3 regex? Chris Angelico <rosuav@gmail.com> - 2015-01-13 07:32 +1100

csiph-web