For example,string is abc123CD need to find out a method to read only numbers in the string i.e.
abc123CD
select a_postgres_function(\'a
As per ntalbs's Answer
Wrap that query into a Function
create or replace function shownums(text) returns integer as $$ select (regexp_matches($1,'\d+'))[1]::int; $$ language sql;