Skip to Content
0
Apr 23, 2018 at 08:02 AM

Extract numbers from a string after a matching string occurence

676 Views

Dear Experts,

I have a table which contains comments field against each material entry. I have to extract the numbers after the string "AVAR" that means

Example row:

Material X - 'this product 123 AVAR0001256701 manufactured in AVAR0001256725'

Expected output:

 X       0001256701
 X       0001256725

I tried with following

Select REPLACE_REGEXPR('\D' IN 'this product 123 AVAR0001256701 manufactured in AVAR0001256725' WITH '_') From Dummy;

but this returning output like

_____________123_____0001256701_____________________0001256725

Select Substr_REGEXPR('([0-9]+)' IN 'this product 123 AVAR0001256701 manufactured in AVAR0001256725' ) From Dummy;
This is returning me first occurrence of the number i.e. 123

I need to split them into rows.

Could anyone help me how to achieve this?

Thanks in advance!

With regards,

Naru.