This discussion is archived
1 Reply Latest reply: Feb 12, 2013 2:15 PM by Gary Graham RSS

REGEXP_REPLACE question

user11089573 Newbie
Currently Being Moderated
Hi Everyone,

I have a unique scenario in where I need to use the regexp_replace function to accomodate what the client is looking for. Here is the scenario, they have field for an address that has ''1000 Jefferson's Hou'snty Parkway" and they want the 's' in Jefferson's to stay lower case but the 's' in Cou'snty should be upper case. So the regexp_replace function needs to look at the string '1000 Jefferson's Hou'snty Parkway' and understand that if the 's is at the very end then it needs to be lower case but the other one needs to be 'S.

Here is what I have so far but it only takes care of the Jefferson's scenario but not the Hou'snty word. Can you help me in writing the correct expression for this scenario?

select regexp_replace(ADDRESS_1, '''S$','''s')
from MY_TABLE

Thanks for your help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points