Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

r remove regex from string

library(stringr)
fruits <- c("one apple", "two pears", "three bananas")

# Remove first occurance of regex pattern
str_remove(fruits, "[aeiou]")
#> [1] "ne apple"     "tw pears"     "thre bananas"

# Remove all occurances of regex pattern
str_remove_all(fruits, "[aeiou]")
#> [1] "n ppl"    "tw prs"   "thr bnns"
Source by stringr.tidyverse.org #
 
PREVIOUS NEXT
Tagged: #remove #regex #string
ADD COMMENT
Topic
Name
4+6 =