Filename format pattern (novice user)

I am testing JabRef to see if it is a viable option as an index for maintaining a large collection of scientific journal publications (currently 45.000 pdf files).

Part of the functionality I intend to use is to automatically structure the file locations and filenames of the saved pdf files.
The database is set to biblatex mode.
The filename format pattern is: [journal] [YEAR], [volume][number:regex(".+", “($0)”)], [firstpage]-[lastpage]
The example file carries as journal title: {ACS} Medicinal Chemistry Letters

In the resulting filename the curly braces are replaced with underscores (e.g. ACS Medicinal Chemistry Letters 2013, 4(5), 491-496.pdf).
How do I get rid of these underscores? I prefer to do the correction in the [journal] field over a correction to the entire filename.

I tried :regex("_",""), :regex("\\_",""), :regex("{",""), :remove_braces, :latex_cleanup but none of these options changes anything to the resulting filename.

I looked a bit into the issue and tried to come up with a solution. The key problem here is that JabRef interprets the curly braces as protected term and does not replace them. That’s why the regex formatter has no effect. So the curly braces stay the same.
Remove braces only works for braces at the start and at the end of the whole field content.
The underscores are coming from the file name generator, because curly braces are illegal characters in file names, they are replaced with underscores. However, this happens after the evacuation of the bracketed patttern

Maybe @k3KAW8Pnf7mkmdSMPHz2 has another idea.

Which version of JabRef do you use? In my opinion [journal:regex("_","")]`` is the most likely to succeed, but I can’t really test anything before Monday :confused:

From about JabRef:
JabRef 5.4–2021-07-24–1cdd807
Windows 10 10.0 amd64
Java 16.0.1
JavaFX 16+8

I tried the regex, but it doesn’t solve the issue.

An additional observation:
After applying the function: Rename file to a given pattern. This option is inactivated for this item and the filename can only be changed using Rename file to a given name. This makes sense as long as the settings in Options > Preferences > linked files > Filaname format pattern are the same. But after changing this definition, the function should be available again.

What @Siedlerchr says is correct. The :regex modifier respects {protected} terms. The correct way of dealing with this should be [JOURNAL:unprotect_terms], but for some reason, unprotect_terms is currently not included in the available modifiers.

Until it is (re?)added I think [JOURNAL:latex_to_unicode] is your best bet, although the latex_to_unicode can have unexpected consequences.

There does seem to be some bug with updating the file name pattern, I’ve had to restart JabRef before it worked properly. I think there was a GitHub issue or PR regarding preferences not always updating correctly. I’ll have to see if I can dig that one up.

Add `unprotect_terms` to the list of modifiers for bracketed patterns by k3KAW8Pnf7mkmdSMPHz27 · Pull Request #7960 · JabRef/jabref · GitHub for the re-adding.

What could be such consequences? Are they discussed somewhere (manual or this forum)?

I don’t think they are discussed anywhere, and in general, it should be fine, it is just good to be aware that there are some limitations such as,

  1. You can write latex expressions that cannot be represented in Unicode, and since we are using a third-part library for latex → unicode (GitHub - tomtung/latex2unicode: Convert LaTeX markup to Unicode (in Scala and Java)) it is up to it how it deals with those situations
  2. If the field contains incorrect latex the original text is used instead (even if part of the latex is correct)
  3. It doesn’t use or respect any style or included latex libraries

I wouldn’t expect any issue with journal, author, or similar, but I’d be more careful about using the abstract. And if you have 45 000 files it is likely that at least one title contains a latex expression that causes unexpected output (e.g., the wrong “var epsilon” char or incorrect latex).

Fortunately, most file systems support Unicode letters these days.

If it is only this particular thing you are having an issue with, unprotect_terms should work in the latest dev version found at index - powered by h5ai v0.29.0 (

Just remember to backup your library before using a dev build!