Regular expression to process key value pairs
Posted
by
user677680
on Stack Overflow
See other posts from Stack Overflow
or by user677680
Published on 2011-11-29T01:45:37Z
Indexed on
2011/11/29
1:50 UTC
Read the original article
Hit count: 121
I am attempting to write a regular expression to process a string of key value(s) pairs formatted like so
KEY/VALUE KEY/VALUE VALUE KEY/VALUE
A key can have multiple values separated by a space.
I want to match a keys values together, so the result on the above string would be
VALUE
VALUE VALUE
VALUE
I currently have the following as my regex
[A-Z0-9]+/([A-Z0-9 ]+)(?:(?!^[A-Z0-9]+/))
but this returns
VALUE KEY
as the first result.
© Stack Overflow or respective owner