Offhand, I think you should be able to get away with just escaping single quotes. To do that, just replace(field, '''', '''''). That's not exactly ideal though, of ...