I need to determine whether a string matches one substring, but not another. For example, given the substrings "john" and "mary", where "john" must be present and "mary" must not:

"My name is john" -> matches

"My name is mary" -> no match

"Their names are john and mary" -> no match

Note that the two strings are not interchangeable, "john" is always the one to be matched, and "mary" must never match, so it is not a simple XOR operation