Can anyone suggest me a solution in Regular Expression, to match a string if it does not exist in the given string.
Suppose I have a String
Rohan is going to Home
and I don’t want that
Going to
string should exist, then it will not return. But if the string does not contain contains “going to”, then string will be returned
Valid
- Rohan is at Home
Invalid
- Rohan is going to Home
I have heard that regex isn’t well suited to negate something (except a single character). Regex is more intended to match strings, not “not match” them. Still if someone have solution please suggest in Regular Expresion
I have tried to create a Regular Expression,but didn’t get success till now.
SELECT 1
FROM DUAL
WHERE REGEXP_LIKE (' Rohan is 12 home'
, '^\s[^going to])$','i');
Try this, which uses a negative look ahead: