I need to remove the hyphen including all the letters after hyphen.
so the above string (
ABC3245-bG1353BcvG34
) should beABC3245135334
This suggests that all numbers should remain after the hyphen (in their original order). If that's what you want, you cannot do this with a single regex. Assuming you can have only 1 hyphen in your input:
SELECT substring(input.value from '^[^-]*') ||
regexp_replace(substring(input.value from '[^-]*$'), '\D+', '', 'g')
FROM (SELECT 'ABC3245-bG1353BcvG34'::text AS value) AS input
If you can have multiple hyphens in your input, please define how to handle characters between hyphens.