Convert ends_with to a regexp test.