Using stringr
, I tried to detect the €
sign at the end of the line as follows:
str_detect("my text €", "€\\b")
Why is this not working? It works in the following cases:
str_detect("my text a", "a\\b") # TRUE - letter instead of € grepl("€\\b", "2009in €") # TRUE - base R solution
But it also fails in perl mode:
grepl("€\\b", "2009in €", perl=TRUE) # FALSE
So what is wrong with €\\b
regex? The regular expression €$
works in all cases ...
source share