fork download
  1. a <- c('"You Are There" (1953) {The Death of Socrates (399 B.C.) (#1.14)}', 'Þegar það gerist (1998/I) (TV)', 'Johannes Passion, BWV. 245 (1725 Version) (1996) (V)')
  2. sub("^.*?\\((\\d{4})(?:/[^)]*)?\\).*", "\\1", a)
  3.  
  4. regmatches(a, regexpr("\\(\\K\\d{4}(?=(?:/[^)]*)?\\))", a, perl=TRUE))
Success #stdin #stdout 0.15s 176448KB
stdin
Standard input is empty
stdout
[1] "1953" "1998" "1996"
[1] "1953" "1998" "1996"