A.] The objective is to set up a filter, which is applicable to file names. The filter should find the file names in which the track number matches the following numbering style:
101
206.
710.
911.
ā Three numerals followed by a dot, all of which are located at the very beginning of the file name.
B.] Can one filter be made to cover in one application the matches for differently styled track numbers, all located at the beginning of the file name? Here follows an example of the track numbers in question:
10
74.
101.
706.
1-15.
6-15.
The method eludes me, completely, hence, I welcome your assistance ā if only for the aforementioned, much needed A.]
%_filename% HAS ?
Thank you.
PS. The first number, as shown in each of the two series above, deliberately does not have the obligatory dot to avoid the message text getting re-formatted.
A digit ("number") that exists at least once or unlimited times, followed by a - in the first occurence and followed by a . ("dot") for the second occurence. The dot is a special character in regular expressions and has to be escaped with a\.
Thank you very much to you both, @ohrenkino and @LyricsLover. Especially also, to both of you for adding the explanations in there, too. I am beginning to recognise some of the patterns now.
No, the parenthesis are there to "collect/remember" the matched digits or characters.
For example, if you want to replace the matched characters with some other values, you need the parenthesis. They build groups for later use.
@ohrenkino gave you a solution for filenames, using such parenthesis:
If you want so search for parenthesis as ordinary character, you have to escape them like this \( for an opening bracket and \) for a closing bracket
I have much to work with. My problem stems from using the caret "^", the regex special character, as part of the album name for multi-disc albums, for example:
Album name A (CD3^6)
Album name B (CD07^16)
Therefore, the caret is part of the field description, and part of the expression. How these play on each other, is what I am trying to understand.
If you search for a text or number which has to be mandatory at the start position or at the end position, you have to use the ^ as very first character in your regular expression and/or $ as very last character in your regular expression.
if you search for ^ as part of your album name, as in your example Album name A (CD3^6)
then you have to escape the ^ as special character with \^ like this: %album% MATCHES \^
(this would search for any occurence of ^ in your current %album% tag).
Or more specifically: %album% MATCHES CD\d+\^\d+
(search for CD followed by at least one digit, followed by ^, followed by at least one digit.)
And explicitly for your given content: %album% MATCHES "\(CD\d+\^\d+\)"
(search for an opening bracket, followed by CD followed by at least one digit, followed by ^, followed by at least one digit, followed by a closing bracket.)
If you define that the above regular expression should only match, if this combination is the last part in your tag (= nothing is allowed to follow after the closing bracket), then you could add the $ function like this: %album% MATCHES "\(CD\d+\^\d+\)$"
Here is a list of such special characters with "double meaning". They all need to be escaped to search for them literally. (Sorry, I don't know the exact english word for this double functionality.)
(search for CD followed by at least one digit, followed by ^, followed by at least one digit.)
And explicitly for your given content:
%album% MATCHES "(CD\d+^\d+)"
(search for an opening bracket, followed by CD followed by at least one digit, followed by ^, followed by at least one digit, followed by a closing bracket.)
Having tried the aforesaid filter courtesy of @LyricLover, and not seeing the desired results, I tried out more of my own combinations for hours on end, to try and learn something from the experience. Of course, none did the job, because, eventually, I noticed an error I made in my original presentation here: I omitted a space between the word "CD" and the first digit following after it, which in turn is directly followed by the caret "^".
(
CD Space
1st single, or, multi-digit
^
2nd single, or, multi-digit
)
Examples:
(CD_1^6)
(CD_10^12)
where: the underscore "_" represents the space.
I gave up here: %album% MATCHES \(CD\s\d+\^\d+\). Please, show me where I erred?