It works with a conditional in Python when the first capturing group is repeated:
\b(\w)?(\w)\w?\2(?(1)\1)
The (?(1)\1)
translates to: if the first capturing group was successful, match the first captured group again.
The differences are most likely due to the way the regex engines treat an optional non-matched capturing group differently. E.g. RegExr uses the JavaScript engine in your browser, which treats an empty capturing group as undefined. When undefined is attempted to match at the end of the string again, it will succeed. In Python however, it's different and will only succeed to match again if the optional capturing group was successful. It's just down to implementation details.