postgresql – regex to split a string into float/number and string

How can I split the following using regex.

'abcd1234567ef' into 'abcd', '1234567', 'ef'
'abcd1234567.89ef' into 'abcd', '1234567.89', 'ef'

I need to split a string in Postgres SQL which may or may not have decimal numbers.
I have tried this SELECT regexp_match('abcd1234567ef', '(?:(.*?)(d+)(.*)){1,1}'); from the Postgres document, works only for the first case.

EDIT: After getting that working with rewritten’s answer, There were some columns which have data in the form
'abcd12efg34567hij'
which needs to be split as either
'abcd', '12, 'efg', '34567', 'hij' or
'abcd', '12efg', '34567', 'hij'.
Either will work for me

Source link