@@ -54,7 +54,7 @@ public static List<String> groups(String source, String regex) {
54
54
regex = StringUtility .replace (regex , Constant .REPLACE_MAP );
55
55
}
56
56
Pattern p = Pattern
57
- .compile (regex , Regex .OPTION_MULTILINE_CASE_INSENSITIVE );
57
+ .compile (regex , Regex .OPTION_MULTILINE_CASE_INSENSITIVE );
58
58
Matcher m = p .matcher (source );
59
59
List <String > groupList = null ;
60
60
if (!m .find ()) {
@@ -72,7 +72,7 @@ public static List<List<String>> multiGroups(String source, String regex) {
72
72
regex = StringUtility .replace (regex , Constant .REPLACE_MAP );
73
73
}
74
74
Pattern p = Pattern
75
- .compile (regex , Regex .OPTION_MULTILINE_CASE_INSENSITIVE );
75
+ .compile (regex , Regex .OPTION_MULTILINE_CASE_INSENSITIVE );
76
76
Matcher m = p .matcher (source );
77
77
List <List <String >> multiGroupList = new ArrayList <List <String >>();
78
78
while (m .find ()) {
@@ -93,7 +93,7 @@ public static Pair<String, List<String>> getActionRegex(String actionKey) {
93
93
String configParameter = "(\\ {[a-z0-9]*\\ })" ;
94
94
String digitalAndLetter = "([a-z0-9\\ -]*)" ;
95
95
Pattern p = Pattern
96
- .compile (configParameter , Regex .OPTION_MULTILINE_CASE_INSENSITIVE );
96
+ .compile (configParameter , Regex .OPTION_MULTILINE_CASE_INSENSITIVE );
97
97
Matcher m = p .matcher (actionKey );
98
98
String urlRegex = actionKey ;
99
99
List <String > parameters = new ArrayList <String >();
@@ -107,4 +107,24 @@ public static Pair<String, List<String>> getActionRegex(String actionKey) {
107
107
}
108
108
return Pair .create (urlRegex , parameters );
109
109
}
110
+
111
+ public static boolean matchPatterns (List <String > patternList , String path ) {
112
+ for (String pattern : patternList ) {
113
+ if (path .matches (pattern )) {
114
+ return true ;
115
+ }
116
+ }
117
+ return false ;
118
+ }
119
+
120
+ public static List <String > adapterWildcard (List <String > regexList ) {
121
+ if (regexList == null || regexList .isEmpty ()) {
122
+ return null ;
123
+ }
124
+ List <String > newPatterns = new ArrayList <>();
125
+ for (String pattern : regexList ) {
126
+ newPatterns .add (pattern .replace ("*" , ".*" ));
127
+ }
128
+ return newPatterns ;
129
+ }
110
130
}
0 commit comments