trim and substring untill special characters

Database

trim and substring untill special characters

Hi all,

       I need help to trim a string and display part of the string untill a special character is found.

For EX

1. ABC(TM) is the brand value --> should display ABC(TM)

2. This is a trademark of XYZ(R) used worldwide --> Should display This is a trademark of XYZ(R)

3. XY™ is the brand name --> should display XY™

4. AB® is the brand name --> should display AB®

I am able to trim the string in example 1 and 2. I need help to trim when a string has superscript. 

Thanks for the help

2 REPLIES
N/A

Re: trim and substring untill special characters

You need a Regular Expression:

REGEXP_SUBSTR(col,  '.*(\(TM\)|\(R\)|®|™)', 1, 1, 'i')

Re: trim and substring untill special characters

Thanks Dieter Nöth , it works.