0

Can anyone help me solve this? I'm a bit of a newbie in programming and I'm looking at using REGEXP_SUBSTR in my query. I have a large file and I need to use only certain parts.

I want to convert this: Stuart, Martin E ([email protected]) to this: [email protected]

I'm using regexp_substr and have got it to display everything apart but I have an annoying bracket on the end of the email address I need to get rid of. Can anyone help please?

SELECT regexp_substr ('Stuart, Martin G ([email protected])', '[^("]+',1,2)
FROM dual;

REGEXP_SUBSTR('STUART,MARTING(
------------------------------
[email protected])

2 Answers 2

1
select regexp_substr ('Stuart, Martin G ([email protected])', '[^)("]+',1,2) from dual;

Just add the closing bracket inside [^]

Sign up to request clarification or add additional context in comments.

Comments

0
 select regexp_substr ('Stuart, Martin G ([email protected])', '[^()]+',1,2) from dual;   

works fine. And why are using the literal " in the expression.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.