I only want the numeric part of this string column:
identity |
---|
student:1234 |
student:56 |
student:789 |
id:driver_license-111-AZ |
id:learner_permit-222-NY |
So that the output should be:
wanted |
---|
1234 |
56 |
789 |
111 |
222 |
I am using PostgreSQL 8.0.2 (Amazon Redshift) and I think SELECT REGEXP_SUBSTR(identity,'[0-9]') FROM table
should work. But it does not. I tried multiple variations of optional arguments in the REGEXP_SUBSTR but I can't get it to work. Would someone please help me? With this function or otherwise.