I want to remove anything between <
and >
including (<
and >
) from my string with regular expression. Here are fe
Try using the regex:
<.*?>
For example:
String s = "Hi<friends>and<family>";
System.out.println(s.replaceAll("<.*?>", ""));
String newStr = str.replaceAll("<[^>]*>", "");
Give this code segment a try!
String str = "Hi<family>and</family>test";
for (int i = 0; i < str.split("</?[a-z]+>").length; i++)
System.out.println(str.split("</?[a-z]+>")[i]);