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


Groups > comp.lang.python > #53172

Re: String splitting with exceptions

Date 2013-08-28 12:32 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: String splitting with exceptions
References <kvl9e5$19gk$1@leila.iecc.com> <1377710043.22605.15211369.55EB0B33@webmail.messagingengine.com>
Newsgroups comp.lang.python
Message-ID <mailman.320.1377711095.19984.python-list@python.org> (permalink)

Show all headers | View raw


On 2013-08-28 13:14, random832@fastmail.us wrote:
> On Wed, Aug 28, 2013, at 12:44, John Levine wrote:
> > I have a crufty old DNS provisioning system that I'm rewriting
> > and I hope improving in python.  (It's based on tinydns if you
> > know what that is.)
> > 
> > The record formats are, in the worst case, like this:
> > 
> > foo.[DOM]::[IP6::4361:6368:6574]:600::
> 
> Otherwise:
> >>> re.findall('((?:[^[:]|\[[^]]*\])*):?',s)
> ['foo.[DOM]', '', '[IP6::4361:6368:6574]', '600', '', '']
> 
> I'm not sure why _your_ list only has one empty string at the end.

I wondered that.  I also wondered about bracketed quoting that
doesn't start at the beginning of a field:

  foo.[one:two]::[IP6::1234:5678:9101]:600::
          ^
This might be bogus, or one might want to catch this case.

-tkc

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


Thread

String splitting with exceptions John Levine <johnl@iecc.com> - 2013-08-28 16:44 +0000
  Re: String splitting with exceptions Skip Montanaro <skip@pobox.com> - 2013-08-28 11:55 -0500
  Re: String splitting with exceptions random832@fastmail.us - 2013-08-28 13:14 -0400
    Re: String splitting with exceptions John Levine <johnl@iecc.com> - 2013-08-28 21:35 +0000
  Re: String splitting with exceptions Tim Chase <python.list@tim.thechases.com> - 2013-08-28 12:32 -0500
    Re: String splitting with exceptions Neil Cerutti <neilc@norwich.edu> - 2013-08-28 18:18 +0000
  Re: String splitting with exceptions Neil Cerutti <neilc@norwich.edu> - 2013-08-28 18:08 +0000
    Re: String splitting with exceptions Peter Otten <__peter__@web.de> - 2013-08-28 20:31 +0200
  Re: String splitting with exceptions wxjmfauth@gmail.com - 2013-08-29 00:26 -0700

csiph-web