I have a requirement to scan a folder and filter the files which matches a specific regular expression pattern.
Sample code in the accept method of the FileNameFilter
Scanner fileNameScanner = new Scanner(fileName);
Pattern mainPattern = Pattern.compile(this.pattern);
fileNameScanner.findInLine(mainPattern);
MatchResult result = fileNameScanner.match();
Now, I need a regular expression which filters the file which matches files with names like impl-2.0.xml and at the same time, it should not match impl-Test-2.0.xml.
I tried few settings but does not seem to work. It picks impl-Test-2.0.xml as well.
<string>-<major>.<minor>.xml? If you can describe in words what you are looking for, we can help you write the regular expression.