Regex to capture a group but exclude certain phrases

This was the updated regex that solved my issue. Much thanks for the help getting me 95% of the way there.

^You (grab|remove) (?:\( ([a-z]+ )\) )?(?:< [a-z]+ > )?\b(?:(?:an?|the|of) )?((?!,)[A-Za-z'-]+)\,? ?((?:(?!(?:an?|the|of)\s)[A-Za-z'\-]+?\s)*)(?:(?:an?|the|of(?:\sthe)?) )?(?:(.+?)?\s)(?:which you held in|with) your (right|left).+?\.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top