call regfree before changing regex