1

assuming i have these following phrases:

  1. "apple orange pear"
  2. "orange apple"
  3. "apple"
  4. "pear orange"
  5. "apple pear"

I want to match all phrases containing "apple" but only when it doesn't contain "orange" i.e. 3 & 5

How can i do it using just a single regex expression in R with functions e.g. grepl() but with only 1 regex expression? i.e. grepl(regex, vector) = F F T F T

Andy
  • 191
  • 10

0 Answers0