Indeed!
I think (?: () )? and ()? works in general, but I’m not sure which of the RE engines keep track of skipped/empty capturing groups and let you reference them. As a JS beginner I wasn’t sure it would work, but I felt it should. So I gave it a try and confirmed that it did. (I got the impression somewhere that the ECMA engine is one of the more advanced ones)
And thank you for expanding on whose. Your explanation seems congruent with my basic understanding, even if I don’t have the proper technical vocabulary for it yet.