fork download
  1. x <- c("NE-390-SM-04", "90055-SL-01-J", "NE-1478-SL-02", "87007-QM-01-J", "NE-9315-BM-01-A", "3121-SP-01", "1639-YL-01", "NE-9922-WM-01-J", "ND-2498-YL-01", "C-4008-PP-03-J", "876-C-4008-PP-03-J-234")
  2. sub("^.*?([0-9]+-[a-zA-Z]{2,}-[0-9]+).*", "\\1", x)
Success #stdin #stdout 0.21s 60752KB
stdin
Standard input is empty
stdout
 [1] "390-SM-04"   "90055-SL-01" "1478-SL-02"  "87007-QM-01" "9315-BM-01" 
 [6] "3121-SP-01"  "1639-YL-01"  "9922-WM-01"  "2498-YL-01"  "4008-PP-03" 
[11] "4008-PP-03"