I'm trying to match lines that doesn't end with either .
or !
and doesn't end with either ."
or !"
so it should match both
say "bye"
say "bye
but shouldn't match:
say "bye.
say "bye!
say "bye."
say "bye!"
I tried using positive and negative lookahead, trying to use them as AND as suggested in Regex AND operator, but I can't make it work, nor I'm sure it's feasible with lookaheads.
Just use a negative lookbehind.
This matches exactly what you asked for: ^.*+(?<![.!]"?)$
^
- beginning of line
.*+
- any amount of characters, not giving up for backtracking
(?<!
+ )
- not preceded by
[.!]
- dot or exclamation mark
"?
- optional double-quote
$
- end of line