android - Remove all <tag></tag> with text between -
i'm trying remove text tagged (including tags)
<tag>text</tag> from string.
i have tried
.replaceall("<tag>.+/(tag)*>", "") or
.replaceall("<tag>.*(tag)*>", "") but neither works correctly , can't replace tagged text ""
i don't know want, here few options:
string text = "ab<tag>xyz</tag>cd"; // between text.replaceall("<tag>.+?<\/tag>", "<tag></tag>"); // ab<tag></tag>cd // text.replaceall("<tag>.+?<\/tag>", ""); // abcd // tags text.replaceall("<\/?tag>", ""); // abxyzcd edit:
the problem missing ? after .+. question mark matches first occurence, works when multiple tags present case.
Comments
Post a Comment