源码:
public class Test { /**
* @param args
*/
public static void main(String[] args) {
Pattern pattern =Pattern.compile("\\");
Matcher matcher=pattern.matcher("d:\\vv\\vvvv");
if (matcher.find())
System.out.println("真");
else
System.out.println("假");
// System.out.println("d:\\vv\\vvvv".matches("\\"));
}}
运行时报错
Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
^ 我已经用/转义过了,不知道还出错。
public class Test { /**
* @param args
*/
public static void main(String[] args) {
Pattern pattern =Pattern.compile("\\");
Matcher matcher=pattern.matcher("d:\\vv\\vvvv");
if (matcher.find())
System.out.println("真");
else
System.out.println("假");
// System.out.println("d:\\vv\\vvvv".matches("\\"));
}}
运行时报错
Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
^ 我已经用/转义过了,不知道还出错。
改成这样不知道行不行。
System.out.println("d:\\vv\\vvvv".matches("d:\\\\vv\\\\vvvv"));输出true
还是输出FALSE
输出为:true