Adding ^ and $ to regexp if not present.