Improvements on search regex generation. Closes #57