0

I need a regular expression to exclude values of a particular pattern.

REGEXP_LIKE( name,'[0-9].rm')  # this returns values like 123rm, 456rm etc.

I need to exclude values with the above format.

I tried both of the following, but it's not returning anything.

REGEXP_LIKE( name,'^[[0-9].rm]') 
REGEXP_LIKE( name,'^([0-9].rm)') 

Please help! Thanks in advance

3
  • what values do you want to exclude? do you mean numbers? can you show the expected result by example? Commented Jan 22, 2015 at 22:56
  • i want exactly the negation of the above reg expression. it should return values like abc12, abc, ab12ac, rm123, rm12abc etc Commented Jan 22, 2015 at 23:15
  • 2
    doesn't NOT REGEXP_LIKE(...) work? Good luck. Commented Jan 22, 2015 at 23:57

2 Answers 2

1

Since you want the negation of your regexp, you should use NOT in the query condition:

select ...
  from ...
 where ...
   NOT REGEXP_LIKE( name,'[0-9].rm')
Sign up to request clarification or add additional context in comments.

Comments

0

Have you tried:

SELECT * FROM table WHERE NOT REGEXP_LIKE(name, '[0-9].rm', 'c');

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.