Hey All, I have a string that looks like this:
{key1,val1},{key2,val2},{key3,val3},{key4,val4},{key5,val5},...
I'm trying to write a regular expression which can split up that string
and give me a hash back. There are a few gotchas though:
- The key and/or the value may or may not be inside quotes,
- The key and/or the value may contain a comma (it will be quoted if
it does),
- There can be a varying number of key/value pairs, including only
one pair,
- The values may be key/value pairs themselves.
My first attempt was something like: /({[^}]+,[^}]+})+/
But that completely fails at least the last point, if not the others.
Does anyone have any ideas (or pointers to good documentation)?
TIA,
Darryl
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Perl-Unix-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
