fork download
  1. new<-c("111", "1234567891", "12")
  2. sub("^(\\d{3})\\d{7}$", "\\1", new)
Success #stdin #stdout 0.19s 183680KB
stdin
Standard input is empty
stdout
[1] "111" "123" "12"