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

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -