fork(1) download
  1. DF <- data.frame(txt = c('(2) 1G–1G (0)','(1) 1G–1G (4)','(2) 1G–1G (0)'))
  2. DF$txt <- trimws(gsub("[^()–]*\\(([0-9]+)\\)[^()–]*"," \\1 ",DF$txt))
  3. DF
Success #stdin #stdout 0.22s 39736KB
stdin
Standard input is empty
stdout
    txt
1 2 – 0
2 1 – 4
3 2 – 0