fork download
  1. abbrev_regex <- "\\b[A-Z]{3,5}\\b";
  2. x <- "XYZ was seen at WXYZ with VWXYZ and did ABCDEFGH."
  3. sum(gregexpr(abbrev_regex,x)[[1]] > 0)
  4. ## => 3 occurrences
  5. regmatches(x, gregexpr(abbrev_regex, x))[[1]]
Success #stdin #stdout 0.16s 178496KB
stdin
Standard input is empty
stdout
[1] 3
[1] "XYZ"   "WXYZ"  "VWXYZ"