I want to match a file name as "abc (1).xyz" or "abc (2).xyz" or "abc (3).xyz" and so on, in which abc and xyz (extension) is fixed. Besides, the space+(number)  part is optional, i.e. the abc.xyz is also valid.
I have tried the below code, but it didn't returns the success response:
String regex = "abc\\s([0-9])\\.xyz";
        Pattern mather = Pattern.compile(regex);
        if (mather.matcher(fileName).matches()) {
            return true;
        } else {
            return false;
        }
Please suggest any solution for the same. Thanks in advance.
 
    