return a regexp if passed to RegExp(), added regression tests