I am trying to specify a non-greedy operator for a character that comes right before a negative lookahead. Nevertheless, when I specify the non-greedy operator, the word is captured even if the pattern present in the negative lookahead appears in the string.
The example is here
pattern = "\bcuerpos?(?!\W*de\sseguridad)"
strings = ["el cuerpo", "cuerpo a cuerpo",
"fuerzas y cuerpos de seguridad", "fuerzas y cuerpo de seguridad"]
I want this patter not to match the third or the fourth strings, but it does capture the third one. Why does the non-greedy operator erase the negative lookahead functionality here and how would you solve this?