From the below string, I need NUM = 12122 and CheckFrom = 02453226170 only
String s="shopNumber = \"shop 1\", NUM = \"12122\", Reference = \"NUM1\", CheckFrom = \"02453226170\""
how can I do this using regular expression and replaceall function of String class?
Using Matcher.find would make this task a lot easier to extract out the name/value pairs. Essentially you are looking for the pattern
word = "number":m.group(1)relates to the first captured group, (i.e. the match from the word\w+)Builder contains:
Update:
From your question in the comments, you could use instead:
and append the 2 groups together to get your
String.