如何从下面的字符串中删除author:sharmsr(基于匹配条件author)
<text fill="#000000" fill-opacity="1" font-family="Arial" font-size="10" font-style="normal" font-weight="400" stroke="none" textLength="84.875" x="-42.4375" xml:space="preserve" y="3.5">Author: SHARMSR</text>
1条答案
按热度按时间0lvr5msh1#
在中使用简单的正则表达式
String.replaceAll
```String s = "<text fill="#000000" y="3.5">Author: SHARMSR";
String result = s.replaceAll("Author[^<]+", "");
System.out.println(s); // Author: SHARMSR
System.out.println(result); //