I have a value which is duplicated from source (can’t do anything about that). I have read some examples here https://docs.aws.amazon.com/redshift/latest/dg/REGEXP_REPLACE.html
Example value: 2.859,00€2.859,00€
My target output: 2.859,00
So just trimming anything after the first ‘€’. I tried this, but I cannot figure out the correct REGEX expression.
REGEXP_REPLACE(value, '€.*\.$', '')
Advertisement
Answer
Your current regex pattern is including a dot as the final character. Remove it and your approach should work:
SELECT REGEXP_REPLACE(value, '€.*$', '') AS value_out FROM yourTable;