/(?)\bparentDataStore/ ## is a perl regex with a negative lookbehind. It disqualifies "->parentDataStore"
(class|struct)\s+MyClass\b(?!;) ## is a perl regex for a class definition. The trailing negative lookahead (?!;) ensures we don’t match a forward class declaration.
—-Below is a Nov 2010 java example:
The optional positive lookbehind assertion above says to match (and replace) the "MTSMessage" string provided it's preceded by "<" or "</".
The "or" is implemented by q( </? ) i.e lessThen followed by an optional slash
— 2019 grep command highlights the token after "responseRuleSet="
grep --color -P '(?<=responseRuleSet=).*? '
LookAhead is simpler than LookBehind — Compare the syntax. Some languages only support lookAhead.
I feel negative lookAhead is more useful than positive lookAhead. I feel these zero-width assertions are useful in progressive matches, but I seldom need complex progressive.
If you use lookaround you may want to start with sample code and make incremental changes. Plausible but incorrect lookaround patterns abound. This is a time you need to understand how regex engines work.
* explains how (not) to capture a back-reference in a lookAhead.