I want to split a given string, which may contain a numeric value, using regexp_matches(). It must identify the first occurrence of a numeric value containing an optional character and optional decimal numbers. Inappropriate parts must also be returned - both the first and last positions of the array.
Some exemplary input and expected output values:
'hello+111123.454545world' -> {hello,+111123.454545,world}
'he-lo+111123.454545world' -> {he-lo,+111123.454545,world}
'hel123.5lo+111123.454545world' -> {hel,123.5,lo+111123.454545world}
'hello+111123.454545world' -> {hello,+111123.454545,world}
'hello+111123.454545world' -> {hello,+111123.454545,world}
'1111.15' -> {"",1111.15,""}
'-.234' -> {"",-.234,""}
'hello-.234' -> {hello,-.234,""}
I am having problems with the first part of the compliance group in the following expression represented by "TODO". It must correspond to all that cannot be identified as a numerical value.
select regexp_matches('input', '(TODO)((?:\+|-)?(?:\d*(?:(?:\.)?\d+)))(.*)')
, '(TODO)', . ( ). , , , .