Hello everyone,
I have a small issue with regular expression. Look at the following example:
WITH T as (SELECT 'ABC' as a FROM dual
UNION ALL
SELECT 'ABC.Test' FROM DUAL
UNION ALL
SELECT 'XXX' FROM DUAL
)
SELECT a,
regexp_replace(a, '^(ABC)?(\.)?(.+)$','ABC.\3')
FROM t
Don't pay attention to the regexp I did. It's wrong.
What I want is :
- when my string start with something else than ABC, it is replaced by the same string with ABC. in front of it.
- When the string starts with ABC. something, nothing changes
- When the string is ABC (without the final dot) the string doesn't change.
Any idea how I can do that using regexp_replace? (I'm using Oracle 10g)
Thanks