Quick actions

cmd+k|ctrl+k

Navigation

Languages

[Raku] Extracting from .bib file (one liner)

Snippet info

Language

Raku

Visibility

public

Author

raiph.mellor

Created

2021-02-24T11:46:25Z

Updated

2021-02-28T21:00:55.518697Z

# See https://stackoverflow.com/a/45181464/1077672

'derm.bib' .IO .slurp              # Read input from file into a string and

~~ m :global                       # match "globally" (all matches) against a

/ '@article{' (<-[,]>+) ',' \s+    # regex (Raku dialect) that `(`captures`)`
  'title={' (<-[}]>+) '}'  /       # article id and title

andthen                            # and then set "it" to the result and then

.map:                              # for each matched article
    
-> $/ { put "$0: $1\n" }           # print "article: title".
INFO