Reputation: 1
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])
Upvotes: 0
Views: 69
Reputation: 739
select regexp_substr ('Stuart, Martin G ([email protected])', '[^()]+',1,2) from dual;
works fine. And why are using the literal " in the expression.
Upvotes: 0
Reputation: 8797
select regexp_substr ('Stuart, Martin G ([email protected])', '[^)("]+',1,2) from dual;
Just add the closing bracket inside [^]
Upvotes: 1