Regex for key (a,b,c)

Hi
I’m struggling to create my bibkey. I don’t like how the a (or b, c) get added when we have duplicate keys. I want to at least add a “_” but I’m unable apply a regex replace to the duplicate (since it’s not a field by itself). I tried the general replacement in preferences :
a$ → _a
but it didn’t work.
Example : Authora should give Author_a
How can I achieve this?
Thanks
Mel

While _ is not a forbidden character in Java RegEx (See here: Searching within the library - JabRef), _ is a special character in LaTeX and therefore has to be escaped with a backslash like this: \_. So i would avoid to use this as your bibkey if you ever want to export this entry to a LaTeX document.

While looking this up, I think i found a typo in our documentation. _ should probably be removed from the following paragraph: Searching within the library - JabRef

If you really want to, i think you probably want something like this (untested):

:regex("[author][year].+", "[author][year]\_.+")

  • . means: any character
  • + means: one or more times

Hi.
Thanks. However for some reason any regex would be replaced. It just throw : regex[author][year].+[author][year]_.+
I tried some sampler patterns, without success.
I kind of give up… I’m not sure at all global regex are working on a,b,c added. I tried a simple a → z replacement and only “a” letters got changed, not the added duplicate a.
Mel

hmm, you could just try to avoid duplicates by using a very complex citationkey pattern or simply using the ISBN or DOI, if there is any.

I think underscore is just listed as unwanted character, you can check that in the preferences