正如标题所说,我无法匹配"<" Java 8正则表达式中的字符。
以下表达式都评估为false:
"<hello>".matches("<")
"<hello>".matches(Pattern.quote("<"))
"<hello>".matches("\\<")
"<hello>".matches(Pattern.quote("\\<"))
如何在Java 8中的正则表达式中转义尖括号?
答案 0 :(得分:1)
"<hello>".matches("<.*");// => true
你需要匹配wathever来自=&gt;使用。*