Hi luciaisacat,
I have played with the idea from davidfor and came up with the following solution for the calibre editor:
1. open your file in the calibre editor.
2. call search/replace, change to Mode: "regex-function", insert your search string and then click "create/edit"
3. you will see a basis function.
4. insert a name for your new Function and replace the code with:
Code:
import re
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
#call file_name and strip file path and -extension:
newName=(re.search(r'.*?\/([^\.\/]*)\.[^\.]*', file_name).group(1))
newName=re.sub(r'_',r' ',newName) #strip _
newName=re.sub(r' 0',r' ',newName) #strip leading zero
#replace bracket term with newName:
result=re.sub(match.group(1),newName,match.group())
return result
5. confirm with OK and now you can use that function. It will replace whatever is between the brackets in your search string with the file name (minus path and file extension)
Klecks