you can use
(?mxi)^
(?:
(?!.*\b(?:with|there\h(?:is|are))\h+no\b)
.*\bno\b
(?![?:])
|
.*
[?:]\h*n(?![a-z])
)
.*
\R*
regex. : 2 , , no , with, there is there are , , ? :, 0+ (\h), n .
R demo:
sentences <- "The ground was rocky with no cracks in it\r\nNo diggedy, no doubt\r\nUnderstandably, there is no way an elephant can be green"
rx <- "(?mxi)^ # Start of a line
(?: # Outer container group start
(?!.*\\b(?:with|there\\h(?:is|are))\\h+no\\b) # no 'with/there is/are no' before 'no'
.*\\bno\\b # 'no' whole word after 0+ chars
(?![?:]) # cannot be followed with ? or :
| # or
.* # any 0+ chars
[?:]\\h*n(?![a-z]) # ? or : followed with 0+ spaces, 'n' not followed with any letter
) # container group end
.* # the rest of the line and 0+ line breaks
\\R*"
res <- gsub(rx, "", sentences, perl=TRUE)
cat(res, sep="\n")
:
The ground was rocky with no cracks in it
Understandably, there is no way an elephant can be green
x regex . , \\h ( ), \\s ( ), \\n (LF), \\r (CR) .., .
(?i) ingore.case=TRUE.