pre-compile string patterns if given