Filter Rules#
Filter rules allow you to customize the date finding process. Many sequences of letters and numbers can plausibly look like a date and a time. Filter rules determine which are of these candidate dates accepted and which are rejected.
Filter rules have three main parts:
scope – lets you restrict the lifetime or folders of filter rule. See Filter rule scopes.
matching criteria – which kinds of dates does the rule apply to, e.g. dates that use a word for month, or dates using two-digit years. See Filter rule kinds.
multiplier – how this filter rule affects the date’s score. Only the dates with the highest score are accepted, and with a score greater than zero. You can set a filter rule’s multiplier to zero if you always want to reject any matching date, or to somewhere between zero and one if you still consider it a date but only in the absence of better candidates.
You can also add a comment to a filter rule to remind you of its intention.
Regular expression filter rules are special: they are tried first, in order, and any dates they produce are not subject to other filter rules.
Often it’s easiest to manage filter rules as you encounter them in The File Details screen, but if you want to see all the filter rules, or add or reorder them, you can do so in the Filter Rules screen:
Filename Tidy comes with approximately twelve filter rules by default that we think works well for most scenarios while keeping false positives to a minimum, but you are free to delete or edit them, as well as add your own. You can always return to the defaults by clicking the “Reset to defaults” button on the Filter Rules screen.
Filter rule kinds#
Regular Expression Matcher
A regular expression to try on the input, before trying the general date finding algorithm.
Some of the more obscure filename formats are not detected by Filename Tidy’s built-in general date finding algorithm. This filter rule allows regular expressions to be tried, in turn, before running the general date detection algorithm on any unmatched input.
The regular expressions must use named capture groups to indicate the extent of each date (& time) and a named capture group for each component within each date:
(?<date1>...)
for the first date.”(?<y1>...)
for the year within the first date.(?<M1>...)
for the month within the first date, if applicable(?<d1>...)
for the day of month within the first date, if applicable(?<h1>...)
for the hour within the first date & time, if applicable(?<m1>...)
for the minute within the first date & time, if applicable(?<s1>...)
for the second within the first date & time, if applicable
The regular expression syntax is the same as that used by JavaScript with the unicode flag enabled. Read more about JavaScript regular expressions on MDN.
Example: if ‘2006X1’ is to mean ‘January 2006’ then a regular expression that matches that is:
(?<date1>(?<y1>[0-9]{4})X(?<M1>[0-9]{1,2}))
Digit-only & y/M/d order
Matches digit-only dates that have year, month and day-of-month in the specified ordering.
Would match: ‘31-12-2006’ (if order is set to “Day-Month-Year”)
Would not match: ‘31-Dec-2006’
Digit-only & no separators
Matches dates that are digit-only and have no separators between the year, month and day-of-month digits.
Would match: ‘20060102’
Would not match: ‘2006-01-02’
Digit-only & mixed separators
Matches dates that are digit-only and have a mix of separators between the year, month and day-of-month digits.
Would match: ‘2006-01_02’
4-digit year not in range
Matches dates with 4-digit years and the year is outside the specified range.
Would match: ‘1776-01-02’ (if the range is set to 1900-2199, for example)
2-digit year
Matches dates with 2-digit years when the year is within the specified range. It also specifies which 100 years (or fewer) the 2-digit year corresponds to.
Would match: ‘06-01-02’ (if the range is set to 1950-2049, for example)
Would not match: ‘2006-01-02’
2-digit year & y/M/d order
Matches dates with 2-digit years and have year, month, and day-of-month in the specified ordering.
Would match: ‘06-01-02’
Letter on both sides of either date boundary
Matches dates that begin or end with a letter and an adjacent character (that is not part of the date) is also a letter.
Example: a date ‘2006dec31st’ would get matched if it was followed by a letter (as in ‘2006dec31statement.pdf’) but would not get matched if it was followed by punctuation (as in ‘2006dec31st.pdf’)
Month using letters
Matches dates with a month using letters (e.g. ‘January’ or ‘Jan’), as opposed to digits (e.g. ‘01’).
Date & time
Matches dates that have an associated time (specifically, at least the hour is present).
Would match: ‘20060102T1504’; ‘2006-Jan-02 15-04-05’
Would not match: ‘20060102’; ‘2006-Jan-02’
Filter rule scopes#
System-wide scope#
These filter rules apply to all files and folders.
This option might be useful if you are introducing a rule that is highly targetted or is unlikely to be a false positive, such as Regular Expression Matcher filter rule (see Filter rule kinds)
Temporary scope#
These filter rules apply to all files but only until you close Filename Tidy. When you close Filename Tidy, the filter rule vanishes.
This option might be useful if you prefer to be cautious and check ambiguities every time, or you are doing a one-off kind of rename.
Folder-only scope#
These filter rules apply only to to the specified folder and any files within it, including subfolders.
This scope might be useful if you organize files by the company or institution they originated from before using File Rename on them.