I am fetching data from excel and value of fetched cell is
"abc def (<a href = "https://www.example.com">terms and conditions apply</a>)"
and I want to convert it into
"abc def (terms and conditions apply)"
Any idea how to do it ?
答案 0 :(得分:0)
cause.getCause().getCause() instanceof ...
答案 1 :(得分:0)
String s= "abc def (https://www.example.com\">terms and conditions apply)";
s = s.substring(0, s.indexOf('(')+1)+s.substring(s.indexOf('>')+1);
这是你在找什么?
答案 2 :(得分:0)
试试这个
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main{
public static void main(String[] args) {
String regex = "<a(.*)>(.*)<\\/a>";
String string = "abc def (<a href = \"example.com\">terms and conditions apply</a>)";
string = string.replaceAll(regex, "$2");
System.out.println(string);
}
}
输出
abc def (terms and conditions apply)
和输入
abc def (<a href="/some/some/some/href"># this is another sample #</a>) ghi
输出
abc def (# this is another sample #) ghi