I have a data like under mentioned in table in one column name remarks
Will0017,Will0018, Kind0045 , DGRG0012
I want to extract only numbers from the same only like 0017,0018,0045,0012
How can I do the same in mysql.
I have tried like this
select reject_remarks,regexp_substr(reject_remarks,"[0-9]+") from table;
but have anything like I want
I have tried like this
select reject_remarks,regexp_substr(reject_remarks,"[0-9]+") from table ;
3
Answers
You current query shall work fine as in this DBFIDDLE
It might have so happened that, you have syntax error by using reserved keywords like
table
Alternatively;
You can use REGEXP_REPLACE in mysql for the same.
This shall give you expected output as in this DBFIDDLE
you can use REGEXP_REPLACE where ou negate all possible allowed characters
fiddle
When using
regexp_substr
, you need to use the fourth parameter (see: docs):