I have a String like this
"<xxxxxx125xxxx>
<yy2yy>2</yy2yy>
<yy3yy>3</yy3yy>
<yyhhhhyy>50</yyyyy>
<yyyyy>123</yyyyy>"
How can I have an output like:
2 3 50 123
Well, i'm using Android, but I think that it's a global regex right?
Simply use <[^>]+>
regex.
String[] string = new String[] { "<yy2yy>2</yy2yy>", "<yy3yy>3</yy3yy>",
"<yyhhhhyy>50</yyyyy>", "<yyyyy>123</yyyyy>" };
for (String s : string) {
System.out.println(s.replaceAll("<[^>]+>", ""));
}
output:
2
3
50
123
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.