java正则表达式删除字符串中所有<>之间的内容,<>也要删除

如:<>关联功能<br/>多平台<style br/><>测试<999999999999999999999999>题
处理后得到:关联功能多平台测试题

 String s = "<>关联功能<br/>多平台<style br/><>测试<999999999999999999999999>题";
 String result = s.replaceAll("<[^>]*>", "");

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-11-01
例子如下:
String pattern = "([-+*/^()\\]\\[])";
String test = "1237019830+32[89-234]234";
System.out.println("------test1=["+test+"]");
test = test.replaceAll(pattern, "");
System.out.println("------test2=["+test+"]");
这个应该能够满足你的要求,已测试。
运行结果为:
------test1=[1237019830+32[89-234]234]
------test2=[12370198303289234234]