0

How can I exclude next below strings using REGEXP_LIKE.

When the next character of 'TEST' string is - or . or @

Examples:

   [email protected]
   [email protected]
   [email protected]
   [email protected]
   [email protected]

But include:

[email protected]
[email protected]

2 Answers 2

1

try

...
WHERE NOT REGEXP_LIKE(field,'TEST[-.@]')
Sign up to request clarification or add additional context in comments.

Comments

1

Try like this,

WITH t AS (
           SELECT '[email protected]' COL1
             FROM dual
            UNION   
           SELECT '[email protected]'
             FROM dual
            UNION  
           SELECT '[email protected]'
             FROM dual
            UNION  
           SELECT '[email protected]'
             FROM dual
            UNION  
           SELECT '[email protected]'
             FROM dual
          )     
SELECT t.col1
  FROM t
WHERE NOT REGEXP_LIKE(COL1,'TEST[-.@]')
;   

1 Comment

You should remove the ^ to match [email protected]

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.