Home:ALL Converter>ORACLE - regular expressions

ORACLE - regular expressions

Ask Time:2021-09-22T05:39:11         Author:Webb

Json Formatter

Hi I have a string column which need to extract the third word as string:

example:

select notes from prod.client;


1024 xyxyxyx 138 1025 eivneini 345 4. expected result=138
1028 swswsws 345 24090 bububu_ 1 2.   expected result=345
1028 acboru 345 1050 xwindiwf. 1 2.  expected result=345
1028 vnufenu 345 350 dnwufbuw 1 2.  expected result=345
1113 abudbu 138 1114 bububuw 12.5 1. expected result=138

the result should be a string value.

Any idea how to create a regular expression that pick this?

regards

Author:Webb,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/69275839/oracle-regular-expressions
Gordon Linoff :

You can use regexp_substr(). For the third string:\nselect regexp_substr(notes, '[^ ]+', 1, 3)\nfrom prod.client;\n\nHere is a db<>fiddle.",
2021-09-21T21:44:12
yy