Home > Software design >  How to Remove "S/O" from string?
How to Remove "S/O" from string?

Time:06-30

I am looking to remove the leading "S/O" in a string.

Below are my current results:

ID
60079804-S/O PALMER DONAVIN MFG     
60008517-S/O READY CABLE INC.
60008049-S/O ACORN INTERNATIONAL

Below are my Desired Results:

ID
60079804-PALMER DONAVIN MFG     
60008517-READY CABLE INC.
60008049-ACORN INTERNATIONAL

CodePudding user response:

Use below approach

select regexp_replace(id, r'\bS/O\b', '') as id
from your_table              

if applied to sample data in your question - output is

enter image description here

  • Related