You can exclude a specific substring using this type of pattern:
^(?>[^_]++|_(?!PROCESSED))+$
As you can see, this is an alternation between [^_]++ (everything that is not _ ) and _(?!PROCESSED) ( _ , which is not followed by PROCESSED ) .
The interest of this type of pattern is that you avoid checking character by character if there is no _PROCESSED somewhere, but only when you encounter the first character of the string you want to exclude. Thus, the test number is significantly reduced.
The function suggested by naomik seems to be suitable for what you are trying to do:
listFilesMatching(new File("/some/path", "^(?>[^_]++|_(?!PROCESSED))+$");
source share