Optional groups still count when unmatched

Currently, optional groups that weren't matched in the current search, are treated as if the group doesn't exist at all. This causes the group number to be thrown off for any groups after the unused optional group. For example, with a regex of `/(foo)?(bar)/`, on a successful match group 2 should always be `bar`. Currently, the group containing `bar` is only group 2 when `foo` is present; otherwise `bar` will be in group 1.

This also affects named groups when they appear after an unused optional group. In `/(foo)?(?<bar_name>bar)/`, `named_group("bar_name")` will currently only contain `bar` when `foo` is present.