RegEx snippet: Replace part of the title

Thanks to the good documentation, I quickly found out about Actions and used Replace with regular expression. Now that the thread Regular Expressions is closed, I'm sharing my expression in this topic.

A couple of files have this very long track title, where I am only interested in the words after the first colon and space ": " and before the pipe "|".

Der Herr der Ringe (30/30): Ein Zeitalter geht zu Ende | J.R.R. Tolkien: Der Herr der Ringe – Fantasy-Hörspiel-Klassiker (25.12.2022)

My action looks like this:
Field: TITLE
Regular expression: (.*\: )(.*)( \|.*)
Replace with: $2

$2 refers to the second capture group, which is the actual title of the track. You can see a visual example at regex101 for better understanding. At least it helped me a lot :sweat_smile:

As these are nice unique identifiers you could also use an action of the type "Guess value":
Source: %title%
Target format string: %dummy%: %title% |%dummy%

I would use the regular expression if there are no real unique single character constants but variable types e.g. there would not have been a colon but only the number:
Der Herr der Ringe 30/30 Ein Zeitalter geht zu Ende | J.R.R. Tolkien: Der Herr der Ringe – Fantasy-Hörspiel-Klassiker (25.12.2022)
then a \d+ to indicate a variable number would have separated the leading string from the rest.

But your solution is just as nice and there are a number of ways to skin a cat.

I usually go the other way and try to be as specific as possible (your guess value string is specific as well, just to be clear). That's why my latest regexes always include ^ and $ and match the entire string I aim to edit or nothing at all to avoid any false matches. I still visually inspect all the results anyhow but maybe I'm just paranoid.

For example when I standardized 93 bruce springsteen concert recordings yesterday, the date part of the album tags was all over the place.
The naming variations included:
2023-12-24 venue, city, country
2023/12/24 venue, city, country
2023.12.24 venue, city, country
12/24/23 venue, city, country

To correct the last case 12/24/23... I matched (\d{2})/(\d{2})/(\d{2})(.*) and replaced it with 20$3-$1-$2$4 initially, but that also matches 2023/12/24... partially, 23/12/24... to be exact.

While my correction works fine for 12/24/23..., yielding 2023-12-24... as expected (all concerts were from 2000 and newer, otherwise the hardcoded 20 would not work), it also changed 2023/12/24... to 202024-23-12... or some nonesense like that.
Limiting the regex with ^ and $ to ^(\d{2})/(\d{2})/(\d{2})(.*)$ prevented that false match from happening and allowed me to combine all correction combinations into 2 action groups. One with a hardcoded 19 for concerts from before the year 2000 and one with a hardcoded 20 for newer releases.

That is true. When something is consistent and follows a clearly separated pattern like the example from @1stein, "Guess value" works just fine and is usually quicker unless you live and breathe regex.

Today I learned about „Guess Value“, I thank you both!