How can I parse a strings like :
name1="val1" name2="val2" name3="val3"
I cannot use split(\s+) as it can be name = "val 1".
I am doing java but any laguage is okay.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here it is in Java, with a slight variation on the regex, with capturing group to put the name/value pairs into a
Map<String,String>.This usage of
Matcher.find()in awhileloop is typical.API links
java.util.Map<K,V>java.util.regex.Patternjava.util.regex.Matcherregular-expressions.info links