Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
How do I extract all digits from a string with regex in pgsql?
select regexp_matches('dsa8a552a5a2a5?', '\d+');
Will output only 8.
Need to get 8552525
Better use regexp_replace, globally replacing non-digits by an empty string:
select regexp_replace('dsa8a552a5a2a5?', '\D', '', 'g');
Required, but never shown