Reputation: 67
I have regexp: /[aA]\/[aA]/
,
This regexp catch "a/a", "a/A", "A/A", "A/a"
I need to reverse this procedure and to catch everything except the above examples.
So i found in another answers , that i can use "Negative lookahead".
and try it but without success.
This is what i've try : /(?!([aA]\/[aA]))/
Expected results :
"Some text contaning A/A" - Wrong
"Some text that not contain the above" - Right
Upvotes: 2
Views: 51
Reputation: 626794
You may use an anchored negative look-ahead:
/^(?!.*a\/a).*$/ig
It will match any line that does not contain a/a
(case-insensitively).
See demo
If you have multiline text, replace .*
with [\s\S]*
.
Upvotes: 1