I have a Postgres table containing names like "Smith, John Albert", and I need to create a view which has names like "Smith, J A". Postgres has some regex implementations I haven't seen elsewhere.
So far I've got
SELECT regexp_replace('Smith, John Albert', '\Y\w', '', 'g');
which returns
S, J A
So I'm thinking I need to find out how to make the replace start part-way into the source string.