I have a case where I want to be able to find '%string with spaces in it%'. In CAN use a REPLACE in my select, but performance apparently sucks.
In Postgres you can create a functional index, though. So, I ran this:
CREATE INDEX forename_lower_space ON persontest (REPLACE(lower(forename),' ',''));
Works a treat.