Paulomnia
Paulomnia

Reputation: 23

How to not select if value starts with str% but does not end with %str , regex example

suppose I have

in column1

I want to select everything, except if the value starts with "Red.House%" but ignore when it ends with .Value

Result should look like this:

Regex: https://regex101.com/r/vM0pQ3/1 ^(?=Red.House)(?!.Value).

I'm coming from excel, not sure what's the best practive in oracle.

Upvotes: 2

Views: 89

Answers (2)

slambeth
slambeth

Reputation: 897

I haven't done much of it, but there IS a regular expression function in oracle that you could use in your predicates:

WHERE REGEXP_LIKE (field_name, '^(?=Red.House)(?!.Value)');

More here: https://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions018.htm

Upvotes: 0

Tyler Roper
Tyler Roper

Reputation: 21672

Try this:

SELECT * FROM ... WHERE column1 NOT LIKE 'Red.House%' OR column1 LIKE '%.Value'

Upvotes: 3

Related Questions