I'm using regexp_replace to standardize mailing addresses and I've encountered a situation I'm having trouble with.
Consider the following two addresses and what their result should be:
- 115 1/2 East 6th St -> 115 1/2 E 6th St
- 818 East St -> 818 East St
In the second address, "East" is the actual name of the street, not a directional indicator.
For my query, I've attempted
SELECT
regexp_replace(address, 'East[^ St]', 'E ')
but this fails to convert the first address to it's proper format.
How can I write my regexp_replace such that the word East is converted to an 'E' in the first address, but leaves the word intact in the second address?