I have a string like
with xx as (
select 'id9' idno,'untest X456789,W357987 and Q321089 cont group' test from dual)
select * from xx
There are some thosand rows like the following
IDNO | TEST
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
id9 | untest X456789,W357987 and Q321089 cont group
I want to extract words that begin with a letter followed by 6 digits. Also, there should be a comma between them (because later I will place them to multiple rows)
Resulting Table:
IDNO | TEST
+++++++++++++++++++++++++++++++++++++++++
id9 | X456789,X321678,W357987,Q321089
I have tried regexp_replace, but could not reach a solution.
select idno, REGEXP_replace( test,'([^[A-Z]{1}[:digit:]{6},?])') AS test from xx