Displaying 1 result from an estimated 1 matches for "ijkpqrs".
2010 Jun 12
2
Logic with regexps
...n character vector X (below), and two regular exdpressions
## rex1="abc", rex2="ijk", to return the elements of X which match
## rex1 AND do not match rex1:
X <- c(
"abcdefg", # Yes
"abchijk", # No
"mnopqrs", # No
"ijkpqrs", # No
"abcpqrs" ) # Yes
rex1 <- "abc"
rex2 <- "ijk"
ix1<- grep(rex1,X)
ix2<- grep(rex2,X)
X[ix1[!(ix1 %in% ix2)]]
## [1] "abcdefg" "abcpqrs"
Question: is there a way to construct 'rex' from 'rex1' and...