How can i do that, from a simple way?
Asked
Active
Viewed 303 times
1 Answers
1
If you load your xml and have it as a string (or any other object that supports working with regex) you can use pattern:
<pre>(.+?)</pre>
For example:
String mString = "Hello, let's strip <
pre>some</pre> tags";
mString = mString.replaceAll("<pre>(.+?)</pre>", "");
mString will be == "Hello, let's strip tags" after this operation;
P.S. Since I'm lame at escaping tags here, remove all the problems I left in pattern :)
Alex Orlov
- 18,077
- 7
- 55
- 44
-
I'll just leave this here... ;) http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – Kevin Coppock Nov 08 '10 at 16:32