I have a java toString on code generated from XML . We as a company are logging the toString() to logs and I am having trouble making a good regex to mask all the data effectively . Here is the sample to String
String input="com.example.sensitive.info.UserInfo@15b1534[name=User1, clientName=HARVARD LAW SCHOOL, THE, clientId=12345]";
expected output
com.example.sensitive.info.UserInfo@15b1534[name=User1, clientName=****************, clientId=12345]
Can someone help me with a regex that will mask everything up until the last comma(,) before the next equal =
here is what I tried
maskPatterns.add("clientName=(.*?)=");
This ends up masking till next = . I cant seem to figure how to have it backtrack to last comma(,) before next equal(=).
Also if anyone has better regex for it I am all ears