Need help on citation key generator

I am struggling to write regex to make citation key look like this:

[first_author_name]_[year]_[title_seperated_with_underscore]

The first two parts is already available, however, I cannot achieve the result where only the first three words are concatenated with underscores seperating them. The expected output would be like this:

@article{nagaosa13_topol_proper_dynam_magnet_skyrm,
  author          = {Naoto Nagaosa and Yoshinori Tokura},
  title           = {Topological Properties and Dynamics of Magnetic Skyrmions},
  journal         = {Nature Nanotechnology},
  volume          = 8,
  number          = 12,
  pages           = {899-911},
  year            = 2013,
  doi             = {10.1038/nnano.2013.243},
  url             = {https://doi.org/10.1038/nnano.2013.243},
}

Could some one help me? Iā€™m trying to make this key pattern as I already got lots of entries in my bib file with this naming convention.

Hey :slight_smile:
Customize the citation key generator - JabRef will be of tremendous help, if you try to work with citationkey patterns.

I experimented a little and I think [auth]_[year]_[shorttitle:regex(" ", "_")] could maybe fulfill your criteria! :slight_smile:

Edit:

Explanation:

(:regex(" ", "_") replaces all blank lines in the title field with underscores. The rule is the following:

:regex("pattern", "replacement"): Applies regular expression pattern matching and replacement. 

Thanks for your help! That pattern really works. :smile:

1 Like