Hello guys,
I have an issue with my regular expression and I'm hoping that someone can help me with it?
Imagine the following sample_data:
{code}
WITH sample_data AS
(
SELECT '''test@example.org''' as e FROM dual UNION ALL
SELECT '''test@example.org' as e FROM dual UNION ALL
SELECT 'test@example.org''' as e FROM dual UNION ALL
SELECT '''test.test@example.org''' as e FROM dual UNION ALL
SELECT 'test.test@example.org''' as e FROM dual UNION ALL
SELECT '''test.test@example.org' as e FROM dual
)
SELECT e, REGEXP_REPLACE(e, '(^'')?(.*)(''$)', '\2')
FROM sample_data;
{code}
I would like to remove all leading and trailing quotes from the address email. I did the previous regexp but it does not returns the correct result. I don't know why, but for some reasons, when my email does not ends with a quote, the leading quote is not removed.
Can anyone help me with this?
Thanks,