我試圖找到可以找到字符串「C:\\」的正則表達式。「C:\」的正則表達式
我的代碼是:
String test = "C:\\";
String regex = "[a-z]*[A-Z]*[:]*\\";
if(test.matches(regex))
System.out.println("Success!");
else
System.out.println("Failure!");
我得到一個PatternSyntaxException。我嘗試了很多正則表達式,結果是一樣的。
我該如何解決?