x <- c(
"The dog and the man play in the park.",
"The man plays with the dog.",
"That is the man's hat.",
"Man I love that dog!",
"I'm dog tired",
"The dog park is no place for man.",
"Park next to this dog's man."
)
grepl("^(?!.*park)(?=.*dog.*man|.*man.*dog)", x, ignore.case=TRUE, perl=T)
grepl("^(?!.*park)(?=.*dog)(?=.*man)", x, ignore.case=TRUE, perl=T)
eCA8LSBjKAogICAgIlRoZSBkb2cgYW5kIHRoZSBtYW4gcGxheSBpbiB0aGUgcGFyay4iLAogICAgIlRoZSBtYW4gcGxheXMgd2l0aCB0aGUgZG9nLiIsCiAgICAiVGhhdCBpcyB0aGUgbWFuJ3MgaGF0LiIsCiAgICAiTWFuIEkgbG92ZSB0aGF0IGRvZyEiLAogICAgIkknbSBkb2cgdGlyZWQiLAogICAgIlRoZSBkb2cgcGFyayBpcyBubyBwbGFjZSBmb3IgbWFuLiIsCiAgICAiUGFyayBuZXh0IHRvIHRoaXMgZG9nJ3MgbWFuLiIKKQoKZ3JlcGwoIl4oPyEuKnBhcmspKD89Lipkb2cuKm1hbnwuKm1hbi4qZG9nKSIsIHgsIGlnbm9yZS5jYXNlPVRSVUUsIHBlcmw9VCkKZ3JlcGwoIl4oPyEuKnBhcmspKD89Lipkb2cpKD89LiptYW4pIiwgeCwgaWdub3JlLmNhc2U9VFJVRSwgcGVybD1UKQoK