2017-06-10 14 views

Antwort

0

Sie können dies tun, mit regexp_substr(). Hier ein Beispiel:

select translate(regexp_substr(email, '[.].*@', 1, 1), '[email protected]', 'x') 
from (select '[email protected]' as email from dual) x 
+0

ist es trotzdem unter Verwendung substr und Instrumente und ohne diese Schlüsselwörter –

+0

@SyedAsadullahJ zu verwenden. . . Ja. 'regexp_substr()' ist normalerweise einfacher. –

0
with data (val) as 
(
    select null from dual union all 
    select 'luvi.luci' from dual union all 
    select '[email protected]' from dual union all 
    select '[email protected]' from dual 
) 
-- step:1 
-- find the second group (\2) within the match 
-- ie. (any word/sequence of characters (\w+) flanked by a dot and a @) 
-- step:2 
-- |. OR any other character not matched in step:1 - will be ignored 
-- step:3 
-- \2 for each match found while parsing, for the entire match, 
--  replace it with the second group - so the dot and the @ are dropped from the match 
select val, regexp_replace (val, '(\.(\w+)@)|.', '\2') ss from data; 
Verwandte Themen