Suppose there is a line that does not begin with one line (ivan) and ends with another line (maria). For example,

Peter Mary - suitable
Ivan Marya - not suitable
Ivan Daria - not suitable

How to do it?

    1 answer 1

    For example, using negative lookahead :

    ^(?!иван).*?марья$