I am having a String:
String str = "sourceType=Match, msg=Event yyuyu, test 1, usrPicture=null, friendCount=0";
Now I am writing a regex expression to replace value for "msg" with "...." My regex looks like:
str.replaceAll("(\\smsg=)(.+?)(,)", "$1...$3");
As per my above regex it matches till:
msg=Event yyuyu,
but I want it to match till:
msg=Event yyuyu, test 1,
Basically It should match till last "," (By this I mean it should match till last "," for value of key "msg"). I tried to put some regex after (,). But it's not working. Any help on this will be really appreciated.
msg=(.*?),\s*\S+=$1or\1.usrPicturealways the next attribute aftermsg?