Im assert if there is a "." in a string in R, but grepl always comes back false. Can anyone explain where im going wrong?
Here is my code:
grepl("testtxt",".")
[1] FALSE
grepl("test.txt",".")
[1] FALSE
Im assert if there is a "." in a string in R, but grepl always comes back false. Can anyone explain where im going wrong?
Here is my code:
grepl("testtxt",".")
[1] FALSE
grepl("test.txt",".")
[1] FALSE
We need either fixed = TRUE
grepl("test.txt", pattern = ".", fixed = TRUE)
#[1] TRUE
NOTE: pattern
is the first argument of grep/grepl
If we specify it in different order, make sure to name the parameter
or escape (\\.
) the .
as .
is a metacharacter that matches any character