Regex in R (str_detect) -


what must painfully obvious error expert: how match location of bracket digit pattern in following strings stringr?

library(stringr)  s <- c("ser ser (1 ( asd",        "ser (3 (. asd",        "ser ser (1 (2 asd") 

i want match pattern "(", digit. think right regex "\(\d" command

str_detect(s[1], "\(\d") 

provides

error: '\(' unrecognized escape in character string starting ""\(" 

what's right way write regular expression?

you need escape slashes in r strings

str_detect(s[1], "\\(\\d")  

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -