How to have regexp_replace start with a string replacement at column 15 or beyond

This Oracle query: select distinct regexp_replace(My_column,'(-.*$)','')
looks for a hypen and removes the hypen and any text after the hypen.

What I need is to modify this for the search for the hypen to start at character 15.
Any text in characters 1 to 14 needs to be returned as-is.

Example input: abcdef-abcdefg   x-gorgumplatz
should return:  abcdef-abcdefg   x

Any help on this is greatly appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

select regexp_replace('abcdef-abcdefg   x-gorgumplatz','-.*$',null,15) from dual;

I recommend not using () in your expressions unless you must.  Unlike most code where they simply act as grouping, in a regexp, they cause sub-expression evaluation which requires more resources (cpu and memory.)
another option,

  REGEXP_SUBSTR(my_column, '^.{1,14}[^-]*')

compare with first option...

SELECT REGEXP_REPLACE(my_column,'-.*$',NULL,15),
       REGEXP_SUBSTR(my_column, '^.{1,14}[^-]*')
  FROM (SELECT 'abcdef-abcdefg   x-gorgumplatz' my_column FROM DUAL);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
Without regular expressions, this should work for your sample data -
select replace(col1,substr(col1,instr(col1,'-',-1)))
Note = this removes everything starting with the last hyphen. If there are more than one hyphen after the 15th position, I think you will have to revert to regular expressions.
the replace won't work if the text does not have a "-"  character in it

SELECT REPLACE(col1, SUBSTR(col1, INSTR(col1, '-', -1)))
  FROM (SELECT 'abc' col1 FROM DUAL)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.