finish regex match logic