@@ -56,10 +56,13 @@ public class PlaceholderUtil {
56
56
public static final String ESCAPE_ROUND_BRACKET_OPEN = isWindows () ? "^(" : "\\ (" ;
57
57
public static final String ESCAPE_ROUND_BRACKET_CLOSE = isWindows () ? "^)" : "\\ )" ;
58
58
private static final String ESCAPE_DOT = isWindows () ? "^." : "\\ ." ;
59
+ private static final String ESCAPE_DOT_REGEX = "\\ ." ;
59
60
private static final String ESCAPE_DOT_PLACEHOLDER = "{ESCAPE_DOT}" ;
60
61
private static final String ESCAPE_QUESTION = isWindows () ? "^?" : "\\ ?" ;
62
+ private static final String ESCAPE_QUESTION_REGEX = "\\ ?" ;
61
63
private static final String ESCAPE_QUESTION_PLACEHOLDER = "{ESCAPE_QUESTION_MARK}" ;
62
64
private static final String ESCAPE_ASTERISK = isWindows () ? "^*" : "\\ *" ;
65
+ private static final String ESCAPE_ASTERISK_REGEX = "\\ *" ;
63
66
private static final String ESCAPE_ASTERISK_PLACEHOLDER = "{ESCAPE_ASTERISK}" ;
64
67
private static final String ESCAPE_ASTERISK_REPLACEMENT_FROM = ".+" + Utils .PATH_SEPARATOR ;
65
68
private static final String ESCAPE_ASTERISK_REPLACEMENT_TO = "(.+" + Utils .PATH_SEPARATOR_REGEX + ")?" ;
@@ -236,7 +239,7 @@ public static String formatSourcePatternForRegex(String toFormat) {
236
239
}
237
240
toFormat = toFormat
238
241
.replace (ESCAPE_DOT , ESCAPE_DOT_PLACEHOLDER )
239
- .replace (DOT , " \\ ." )
242
+ .replace (DOT , ESCAPE_DOT_REGEX )
240
243
.replace (ESCAPE_DOT_PLACEHOLDER , ESCAPE_DOT )
241
244
242
245
.replace (ESCAPE_QUESTION , ESCAPE_QUESTION_PLACEHOLDER )
@@ -259,9 +262,9 @@ public static String formatSourcePatternForRegex(String toFormat) {
259
262
260
263
if (isWindows ()) {
261
264
toFormat = toFormat
262
- .replace (ESCAPE_ASTERISK , " \\ *" )
263
- .replace (ESCAPE_DOT , " \\ ." )
264
- .replace (ESCAPE_QUESTION , " \\ ?" );
265
+ .replace (ESCAPE_ASTERISK , ESCAPE_ASTERISK_REGEX )
266
+ .replace (ESCAPE_DOT , ESCAPE_DOT_REGEX )
267
+ .replace (ESCAPE_QUESTION , ESCAPE_QUESTION_REGEX );
265
268
}
266
269
return toFormat
267
270
.replace (PLACEHOLDER_FILE_EXTENSION , "[^/]+" )
0 commit comments