Remove all character except A-Za-z0-9 without regex

365 Views Asked by At

Is there a way to remove all characters except A-Za-z0-9 when querying some column in PostgreSQL without regex? or is the shortest way is regex?

SELECT foo FROM bar;
-- ajhg asjg, asga. 1234 ax
-- desired result: ajhgasjgasga1234ax

-- regex solution:
SELECT regexp_replace(foo,'[^A-Za-z0-9]','','g') FROM bar;
0

There are 0 best solutions below