我有一个svg文件内容,我想根据匹配的子字符串删除一个字符串

wswtfjt7  于 2021-08-20  发布在  Java
关注(0)|答案(1)|浏览(280)

如何从下面的字符串中删除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>
0lvr5msh

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); //

相关问题