I want to remove all the text between < and >. I am trying to get familiar with regular expressions so my code for this looks like:
line.replaceAll("<.*?>","");
I am replacing it line by line using a recursive method.
This is the whole method to clear things up. I am getting the same input and output.
// recursively goes through the string and removes anything surrounded by "< >"
public static void removeTags(String line) {
line.replaceAll("<.*?>","");
cleanString = cleanString + line;
if (sc.hasNext()) {
removeTags(sc.nextLine());
}
}
replaceAlldoesn't affect original string but creates new one.