> 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
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 = '((?:
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 =
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
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
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 = '((?:(?!\|\|\|).)+)(?:\|\|\|)((?:(?!\|\|\|).)+)(