我想要使用这个方法判断是否配置上一个路径下的所有的路径。
例如:
- Java code
String match = "app/_static/*";String path0 = "app/_static/";String path1 = "app/_static/a";String path2 = "app/_static/b/c/Hello.java";String path3 = "app/_static/d/Test.java";.....................String pathn = "app/_static/[sub directory]";boolean match0 = path1.matches(path0); //trueboolean match1 = path1.matches(path1); //falseboolean match2 = path1.matches(path2); //falseboolean match3 = path1.matches(path2); //false
我期望match0、match1、match2和match3都是true,可实际只有match0是true,
请问,要达到我的期望
- Java code
String match = "app/_static/*";//这个match的正则值应该是怎么写呢?谢谢!
------解决方案--------------------------------------------------------
"app/_static/.*";
另外,代码中matches的参数都不对吧