Reputation: 33
I need to split the camel cased sentence into words using SQL.
Example: 'IHaveAPen'
into 'I Have A Pen'
I'm using the regex
select regexp_replace('IAmGoodBoy','([^^])(A-Z)','\1 \2 \3') from dual;
to split strings by capital letter.
but it doesn't work.
Can this be done?
Upvotes: 2
Views: 1530
Reputation: 2133
Try with the following query:
select regexp_replace('IAmGoodBoy','([A-Z][^A-Z]*)','\1 ') from dual;
Upvotes: 3