Fix crash when editing regex pattern with groups