Consider this code:
String path = "c:\\temp";
Pattern myPattern = Pattern.compile(".*filename.XLS.*.\\d{8}_\\d{6}");
How can I replace the first “.*” in myPattern so that path is included in the Regex ?
Something along the lines of
Pattern myPattern = Pattern.compile(path + "filename.XLS.*.\\d{8}_\\d{6}");
which obviously does not work .. 🙂
Cheers,
Tim
You have to escape the backslashes twice:
Once for java and than again for the regular expression.