When setting up the Volume, it is possible to set an optional filter to only report matching files. The filter is defined in terms of regex matching pattern.
Worth remembering while writing the filter:
- The IPV Services use the Microsoft .NET Regex, the details of which can be found here:
".NET Framework Regular Expressions" (https://msdn.microsoft.com/en-us/library/hs600312(v=vs.110).aspx).
Each variety of regex is subtly different, so it is worth checking your knowledge against the .NET implementation.
- The filter is applied to the file's complete full path as visible from within XChange Manager.
e.g. for a File "do_detect_this_file.txt" to be detected on Device: "server1" and Volume: "temp" (recursive), the string to match may be (depending on exact path):
\\server1\temp\temp1\do_detect_this_file.txt
At the beginning of this string is the "\\", which can be matched by ^\\\\ as backslashes need to be escaped. At the end is extension, which can be matched by \.txt$
- Examples:
- Match files ending ".mxf":
\.mxf$
- Match filename starting with "my_media" in the filename portion of the full path e.g. \\server1\folder2\my_media123-151219_reported.ext
\\my_media[^\\]*$
Here:
- the search is not anchored at the beginning of the string, so the server and path do not have to be given explicitly to find the files of interest.
- a backslash symbol must precede "my_media" as a beginning of a filename in the full path always is. This is required but is not unique to filenames, it also matches any folder starting with "my_media" if present in the full path ( e.g. \\server1\my_media_stored_here\other.ext )
- between "my_media" and the end of the string) there can be any amount of symbols with the exception of backslashes: [^\\]* - This guarantees that you are matching only within the filename and the extension - the last segment of the full path.
- Match filename starting with "my_media" in the filename portion of the full path, and ending with extension ".mxf" e.g. my_media123-151219_reported.mxf
\\my_media[^\\]*\.mxf$
As above but you require that before the end of the string the literal match ".mxf" is found.
- To specifically exclude from detection any matching files - Use regex's negated lookahead: "(?!string).".
To show only files which do not contain the string "DoNotMatch" (in the full path), but do have the extension ".mxf", you can use:
^((?!DoNotMatch).)*\.mxf$
From the beginning, any amount of anything that does not match "DoNotMatch", then literal ".mxf", followed by the end of the filename (and the entire full path string).