If your version does not support regexp_replace(), I have written a similar function for easlier versions of postgresql using pl/pgsql called regexp_replacex(). You can find it by searching google groups. As the thread there points out, the function I wrote doesn't treat NULLs properly as posted and there are probably other issues as well. You are free to use it anyways at your own risk. If your version of PostgreSQL does support the regexp_replace() function then you should use it instead as Tom Lane pointed out. -Robert