fixed match begin and end bugs

more careful regex construction for ‘bag’ and ‘one’ options when
checkboxes for match_begin and match_end are checked.