Stripping 'THE' from import

Hi.
I want to retrieve a Text file in Tools to read the contents of a Biography from the parameter: "A://songBiogs/%artist%.txt".
However, the Biographies are saved without the preceding 'THE', so the above fails when it looks for %THE APPLEJACKS% instead of %APPLEJACKS%. (The Biographies are saved automatically with Foobar2000 using <$stripprefix(%ARTIST%>.)
Can anyone show me how to format it to ignore'THE '?
Many thanks

I am not quite sure what you do. Is there really a field name

and you want to use a field called

Or do you want to use the contents of ARTIST and it reads "The Applejacks" but you only need "Applejacks"?
For the first problem I don't know the solution.
The second can be treated if you use
$regexp(%artist%,^The ,)
instead of the plain %artist%

Thanks for this. I adapted your suggestion as best I could ('THE ' is at the beginning of the filename), to search as follows:
"A://songBiogs/$regexp(^THE %artist%.txt"
but just got "syntax error"

You can test expressions in Convert>Tag-Tag.
But even now it would be obvious, that

does not very much resemble

I get, when I use the latter instead of the plain %artist%
A://songBiogs/$regexp(%artist%,^The ,).txt.
this does not take into account possible other problems like double slashes or slashes instead of backslashes.

Thanks. I'm not sure I've explained it accurately. The search is for, eg,
A://songBiogs/THE BAND.txt
but the text file it needs to find is:
A://songBiogs/BAND.txt
Does that make sense? Cheers for the help!

And what does the field ARTIST look like for this example?
Is it "The Band" or "Band"?
A://songBiogs/THE BAND.txt> A://songBiogs/BAND.txt = A://songBiogs/$regexp(%artist%,^The ,).txt.

A://songBiogs/BAND.txt> A://songBiogs/THE BAND.txt = A://songBiogs/THE %artist%.txt.

No, I don't think I have explained this correctly. It is a Tools option.This works great:
image
This doesn't:image
because I can't remove the 'THE ' from the search

Which property does contain the "The"?
Is it the filename of the audio track?
is it as you said here

%artist%?
The regular expression ($regexp()) removes a leading "The" from the referenced string. Currently the string is taken from the field ARTIST.
If this is not correct, then use the correct field.

For the parameter, try this: "A:\songBiogs\$regexp(%artist%,^The ,).txt"
Include the double quotes.

I wonder why the first example works.
It has double forward slashes and forward slashes.
I also do not know if the letter "A" is a valid one for a drive as it was designated for floppy disc drives in the old days.

Drive 'A' works fine in everything else.
Yes, 'THE ' is in the %artist% field, as in the example above and I had also used the double quotes initially.
However, "A:\songBiogs$regexp(%artist%,^The ,).txt" returns this (suggesting it is still looking for THE BEAT'. not 'BEAT'..?):
image

PS: In 'Actions', this works fine to do the opposite, ie, save a FILENAME without the initial THE from the %artist% field...
image

Also, I've just thought that maybe I have given the impressions that this is in 'Actions', when it is actually an operation in 'Options > Tools'

Thanks for the help. I have found a solution, though not ideal because it needs two options because it strips the first four characters regardless. So there is one for %artist% that don't begin with 'THE '...
image
and one for those which do..
image
Ideally, I need a line which strips the first four characters of %artist%, but ONLY if those first four characters are 'THE ' !!!!

The $regexp() function is case sensitive.
If you OS does not care about the case, you could use:
$regexp($lower(%artist%),^the ,)

1 Like

Also, the $regexp() function can be made case insensitive by using the 4th parameter: 1
Like this: $regexp(%artist%,^ThE ,,1)
http://help.mp3tag.de/main_scripting.html#string