2010/7/26 Enrique Palacios <enriquepalaci...@gmail.com>: > HI everyone, > Im new here, this is my first mail and i would like to know how return from > a query only alphanumeric values and these symbols: ().,-% > Something like: > SELECT description FROM products WHERE productid = 5 > RESULT > ====== > X# PRODUCT %1.0/30(UN) > DESIRED RESULT > ============== > X PRODUCT %1.0 30(UN) > I read some info, but it didnt worked out for me using regular expressions > excuse my poor english > thank you very much > --
Try: bdteste=# SELECT regexp_replace('X# PRODUCT %1.0/30(UN)',E'[^\\w\\s().,%-]',' ','g'); regexp_replace ------------------------ X PRODUCT %1.0 30(UN) (1 row) http://www.postgresql.org/docs/current/interactive/functions-matching.html#FUNCTIONS-POSIX-REGEXP Osvaldo -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql