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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to