Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83625
| Date | 2015-01-12 19:48 +0000 |
|---|---|
| From | Ian <hobson42@gmail.com> |
| Subject | Re: Python 3 regex? |
| References | <54B40C85.5000806@emerytelcom.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17635.1421092112.18130.python-list@python.org> (permalink) |
On 12/01/2015 18:03, Jason Bailey wrote: > Hi all, > > I'm working on a Python _3_ project that will be used to parse ISC > DHCPD configuration files for statistics and alarming purposes (IP > address pools, etc). Anyway, I'm hung up on this one section and was > hoping someone could provide me with some insight. > > My script first reads the DHCPD configuration file into memory - > variable "filebody". It then utilizes the re module to find the > configuration details for the wanted "shared network". > Hi Jason, If you actually look at the syntax of what you are parsing, it is very simple. 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. 'Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.' - Jamie Zawinski. Regards Ian
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Python 3 regex? Ian <hobson42@gmail.com> - 2015-01-12 19:48 +0000
Re: Python 3 regex? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-12 15:47 -0800
Re: Python 3 regex? Chris Angelico <rosuav@gmail.com> - 2015-01-13 10:52 +1100
Re: Python 3 regex? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-13 01:54 +0000
Re: Python 3 regex? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-12 18:53 -0800
Re: Python 3 regex? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-13 05:34 +0000
Re: Python 3 regex? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-13 08:01 -0800
Re: Python 3 regex? wxjmfauth@gmail.com - 2015-01-13 11:19 -0800
Re: Python 3 regex? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-14 14:02 +0100
Re: Python 3 regex? alister <alister.nospam.ware@ntlworld.com> - 2015-01-14 15:11 +0000
Re: Python 3 regex? wxjmfauth@gmail.com - 2015-01-14 10:10 -0800
Re: Python 3 regex? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-15 11:33 +1100
Re: Python 3 regex? wxjmfauth@gmail.com - 2015-01-14 23:03 -0800
Re: Python 3 regex? wxjmfauth@gmail.com - 2015-01-15 00:19 -0800
Re: Python 3 regex? wxjmfauth@gmail.com - 2015-01-15 04:49 -0800
Re: Python 3 regex? Steven D'Aprano <steve@pearwood.info> - 2015-01-13 06:39 +0000
Re: Python 3 regex? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-13 09:09 -0800
Re: Python 3 regex? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-13 10:17 -0800
Re: Python 3 regex? Steven D'Aprano <steve@pearwood.info> - 2015-01-13 04:36 +0000
Re: Python 3 regex? alister <alister.nospam.ware@ntlworld.com> - 2015-01-13 13:23 +0000
Re: Python 3 regex? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-13 15:58 +0200
Re: Python 3 regex? Rustom Mody <rustompmody@gmail.com> - 2015-01-14 21:03 -0800
Re: Python 3 regex? Rustom Mody <rustompmody@gmail.com> - 2015-01-14 21:08 -0800
csiph-web