I have the following string:
test0,test1%something1,{"test2%something2","test3%something3", "test4"}
I want to write a regex(via Java String.replaceAll) to get rid of all text between %(including) and comma or quote(excluding) such that I end up with:
test0,test1,{"test2","test3", "test4"}
I have following regex:
(%.*?)[\,,\"]
But this is also capturing the comma or the quote so that I end up with:
test0,test1{"test2,"test3, "test4"}
How do I exclude the comma/quote?
>Solution :
Use this Regex:
%.*?(?=[,"])