as described in the second section of https://github.com/jaynetics/js_regex/issues/21#issuecomment-2544074556