Hello,
I have a string column. I want to extract the 1-2 digit number preceding a specific format: 4X100. So basically, the desired value can be anywhere in the string:
Some text here 4X100 and some text here
16X160 Some text here
Some text here 2X90
How do I just extract just the number preceding the X? So in the first example, all I want is a 4.
Would something like this work?
SELECT Replace(REGEXP_SUBSTR('Some text here 4X100 and some text here', '[0-9]+X'), 'X', '') RESULT FROM DUAL;
Thanks!
I have a string column. I want to extract the 1-2 digit number preceding a specific format: 4X100. So basically, the desired value can be anywhere in the string:
Some text here 4X100 and some text here
16X160 Some text here
Some text here 2X90
How do I just extract just the number preceding the X? So in the first example, all I want is a 4.
Would something like this work?
SELECT Replace(REGEXP_SUBSTR('Some text here 4X100 and some text here', '[0-9]+X'), 'X', '') RESULT FROM DUAL;
Thanks!