regex - Regular Expression to extract string from JSON response -
i trying extract value timezoneid regexr says no match.
here json code:
{ "dstoffset": 0, "rawoffset": 25200, "status": "ok", "timezoneid": "asia/jakarta", "timezonename": "western indonesia time" }
and when test on regexplanet says illegal repetition {\s*"timezoneid"\s*:\s*(.+?)\s*\}
can , explain i'm doing wrong.
update
i parsing result in while loop, need regex line when match "timezoneid": "asia/jakarta",
want grab out asia/jakarta
.
thanks
g
the { , } brackets special characters in regex , need escaped. see more here: patternsyntaxexception: illegal repetition when using regex in java
also, dustmouse said, requiring {} around timezoneid there isn't whitespace between { , "timezoneid". other fields there causing not match.
Comments
Post a Comment