I use a variant of the logic in areve's post from many years back. It strips errant leading track numbers from title tags when I rename the files based on tag info, because I have a specific filename format requirement.
The reason for this was I had a batch of files where the encoding template had incorrectly added a leading whitespace and track numbers to the titles, separated from the actual title with a "." (period/full stop/dot), so this regex in the rename rule fixed it.
It would also work for a tags-from-filename scenario...
Given a file with the following info:
"beatles-pepper-05.flac"
%album%: Sgt. Pepper's Lonely Hearts Club Band
%artist%: The Beatles
%catalogid%: PCS 7027
%track%: 05. Fixing A Hole
%album% $if2(%catalogid% ,"")- $num(%track%,2) -- %artist% - $regexp(%title%,(\s?\d{1,2}\.\s),)
This would rename the file to:
Sgt. Pepper's Lonely Hearts Club Band PCS 7027 - 05 -- The Beatles - Fixing A Hole.flac
The $regexp logic looks first for an optional whitespace character, then matches between 1 and 2 digits (as some tracks were not tagged with track numbers including a leading zero) then a full stop/period, then another whitespace.
That means %track% is simply rewritten to "Fixing A Hole". However it would also match " 5. Fixing A Hole", " 05. Fixing A Hole", "05. Fixing A Hole" etc.
As always, regexr is useful for live explanations of tags and so on. Above example with some sample data: regexr.com/5tov4