Skip to content
Prev 24917 / 63424 Next

grep with fixed=TRUE and ignore.case=TRUE

Seems like a good idea to me.

Here is a workaround that works in any event which combines (?i), \Q and \E .
to get the same effect.  (?i) gives case insensitive matches and \Q and \E
quote and endquote the intervening text disabling special characters:

x <- c("D.G cat", "d.g cat", "dog cat")
z <- "d.g"
rx <- paste("(?i)\\Q", z, "\\E", sep = "")
grep(rx, x, perl = TRUE)  # 1 2
On 5/7/07, Petr Savicky <savicky at cs.cas.cz> wrote: