regex - regular expression find strings with certain pattern in R -
i have strings here , are:
12abc3, 2abc45, abc 56, uhyabc, regexp ... the objective long there 'abc' in string (not 'bca' or 'bac') should return true when using 'grepl'
so output should be
true, true, true, true, false can me this?
thanks in advance
you want use fixed = true in call grepl.
> x <- c("12abc3", "2abc45", "abc 56", "uhyabc", "regexp", "bca", "cab") > grepl("abc", x, fixed = true) # [1] true true true true false false false the fixed argument definition is
logical. if true, pattern string matched is. overrides conflicting arguments.
Comments
Post a Comment