I have an html string which contains br with beginning and ending <> brackets which I want to replace with the "" empty string. I am using the String.replaceAll() method eg message.replaceAll("[<(.|)+?>]", " "). I am able to delete the < and > but not the substring "br". Please help me to modify the regex/pattern.
Thanks for your time. My string is like this
String message = "<strong>" + title + "</strong>" +
"" + message.replaceAll("[<(.|)+?>]", " ") + "";
or message = title + "\n" + message.replaceAll("[<(.|)+?>]", " ");
It is returnning the message with br as it has a substring like . The returned message after replaceAll is Declined from Product Dispensing by Naveen Katoch br Edit Data Entry br. So I don't want the br in the returned message. Or is it possible to put br and replace with empty string. I am doing the same thing eg final String br = "br"; message = message.replaceAll(br, ""); but I wanted to create a pattern/regex inside replaceAll to replace with an empty string.