matcher.match matches only the beginning of the string, effectively changing your regex from /regex/ to /^regex/. This is undesired behavior because 1) it is unexpected because it is not matching versus the real given regex, and 2) more practically, this breaks linting of files that exist in subdirectories. E.g. a file that lives in my_bag/data/objects/my_folder/my_file.txt would not be fully linted with a regex of /my_file.txt/ because the manifest contains the directory information, and matcher.match only looks at the beginning of the string, so the manifest does not get linted, but the file does, because the file list command only returns the filename with no path. Switching to matcher.search fixes this problem by matching anywhere in the string as expected.
matcher.match matches only the beginning of the string, effectively changing your regex from /regex/ to /^regex/. This is undesired behavior because 1) it is unexpected because it is not matching versus the real given regex, and 2) more practically, this breaks linting of files that exist in subdirectories. E.g. a file that lives in my_bag/data/objects/my_folder/my_file.txt would not be fully linted with a regex of /my_file.txt/ because the manifest contains the directory information, and matcher.match only looks at the beginning of the string, so the manifest does not get linted, but the file does, because the file list command only returns the filename with no path. Switching to matcher.search fixes this problem by matching anywhere in the string as expected.