I am trying to accept a capture group only if the pattern matches and there is not a specific word before the end of the group. I've tried a # of approaches and none seem to work, clearly I'm not getting the concept:
https://regex101.com/r/iP2xY0/3 https://regex101.com/r/iP2xY0/4
Regardless of what I do my capture group captures something and my goal is if the reject word exists in the middle of the pattern to return no match.
RC:\*.*?(?P<Capture>(Bob|David|Ted|Alice))(?!Reject).*
- RC:* Hi Bob Smith<\person>
- RC:* Hi David Jones *Notes Bla bla<\person>
- RC:* Hi Ted Warren *Rejected <\person>
Capture Namegrouop is supposed to return:
- Bob
- David
- ''
So "Reject" says if the NameGroup Capture is found followed by anything ending in <
capture it, if between the NameGroup and the < the word Reject
appears do not.