rasetti eswar prasad
rasetti eswar prasad

Reputation: 33

Split the camel cased sentence into words

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

Answers (1)

panagdu
panagdu

Reputation: 2133

Try with the following query:

select regexp_replace('IAmGoodBoy','([A-Z][^A-Z]*)','\1 ') from dual;

Upvotes: 3

Related Questions