RE: Robust regex

2012-11-19 Thread Joseph L. Casale
> Regexes may be overkill here. A simple string split might be better: Yup, and much more robust as I was looking for. Thanks everyone! jlc -- http://mail.python.org/mailman/listinfo/python-list

Re: Robust regex

2012-11-19 Thread John Gordon
In "Joseph L. Casale" writes: > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > string = 'key_1|||value_1key_2|||value_2' > regex = '((?:

Re: Robust regex

2012-11-19 Thread MRAB
On 2012-11-19 20:32, Joseph L. Casale wrote: Trying to robustly parse a string that will have key/value pairs separated by three pipes, where each additional key/value (if more than one exists) will be delineated by four more pipes. string = 'key_1|||value_1key_2|||value_2' regex =

Re: Robust regex

2012-11-19 Thread Benjamin Kaplan
On Nov 19, 2012 12:37 PM, "Joseph L. Casale" wrote: > > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > > string = 'key_1|||value_1key_2|||value

Re: Robust regex

2012-11-19 Thread Chris Angelico
On Tue, Nov 20, 2012 at 7:32 AM, Joseph L. Casale wrote: > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > > string = 'key_1|||value_1key_2|||va