I have below message String. I want to replace all the image tag which contains the occurence of sequence i.e ?custId=1234 with new string cid:
String message = "Need to process image tag <img src=\"http://danny.oz.au/p/56214815-tripod.jpg?custId=1234\"/>";
This what i tried after going thru bit of regex tutorial which replaces all image tag occurence with cid:. I am not getting how to fit the one more filter i.e ?custId=1234 in regex so that replace only those image tags that contains ?custId=1234
message = message.replaceAll("\\<img.*?>", "cid:");
EDIT:- For example if input is
"Need to process image tag <img src=\"http://danny.oz.au/p/56214815-tripod.jpg?custId=1234\"/>";
output should be
"Need to process image tag cid:";
becoz input contains img tag and ?custId=1234 both
input is
"Need to process image tag <img src=\"http://danny.oz.au/p/56214815-tripod.jpg?custId=1235\"/>";
output should be
"Need to process image tag <img src=\"http://danny.oz.au/p/56214815-tripod.jpg?custId=1235\"/>";
becoz input does not contain ?custId=1234 both