[英]regex to ignore a character in between two string?
My String is 我的弦是
**abcd
*[abc]
<td> **Welcome
**Welcome Again
</td>
Is their any way in which I can remove the * symbol in between the tags so that my final string string would be something like 是他们可以删除标签之间的*符号的任何方式,以便最终的字符串类似于
**abcd
*[abc]
<td> Welcome
Welcome Again
</td>
Here all the * between <td>
and </td>
are removed I dont want to use string. 在这里,
<td>
和</td>
之间的所有*都被删除了,我不想使用字符串。
Try this, 尝试这个,
if (s.contains("<td>"))
{
String first = s.substring(0, s.indexOf("<td>"));
String last = s.substring(s.indexOf("<td>"), s.indexOf("</td>") + 5);
System.out.println("result : "+first + last.replace("**", ""));
}
else
{
System.out.println("result : "+s);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.