Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

REGEXP_REPLACE removing leading and trailing quotes.

user13117585Jun 11 2013 — edited Jun 11 2013

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,

This post has been answered by Suman Rana on Jun 11 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 9 2013
Added on Jun 11 2013
4 comments
3,764 views