"The | symbol has a completely different meaning in R syntax than it
has in regular expression syntax."
Well, actually it doesn't -- loosely speaking, they both mean "or" (ok
-- interpreting concatenation as "or" is a bit of a stretch). Perhaps
to clarify your statement (stop here if none is neede
The | symbol has a completely different meaning in R syntax than it has in
regular expression syntax. R hands of pattern strings to the regex library
without looking inside the strings any more than it has to. Likewise, the
regex library has no clue about R syntax. Your attempt failed to create
Hello, there,
My patterns are defined by variables, for example:z="h"v="x"
I have a vector:
a=c("th","mx","t")
I would like to find elements in vector a that contain either "h", or "x"
grep("h|x", a) apparently works. However, when I tried: grep(z|v,a), it did not
work. Can anyone help how to han
3 matches
Mail list logo