Remove any digit only in first N characters

后端 未结 3 1947
攒了一身酷
攒了一身酷 2021-02-14 17:16

I\'m looking for a regular expression to catch all digits in the first 7 characters in a string.

This string has 12 characters:

A12B345CD678
         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-14 17:52

    You can also use a simple negative lookbehind:

    s <- "A12B345CD678"
    gsub("(?

提交回复
热议问题