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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -