The confusion here was caused by 2 facts:
- What
SubtitleEdit
calls a line
is actually a multiline, containing
newlines.
- The newline displayed is not the one used internally (so it would never match
<br>
).
Solution 1:
Now that we have found out it uses either \r\n
or just \n
, we can write a regex:
(?-m)^(?!.*\r?\n)[\s\S]*$
Explanation:
(?-m)
- turn off the multiline
option (which is otherwise enabled).
^
- match from start of text
(?!.*\r?\n)
- negative look ahead
for zero or more of any characters followed by newline
character(s) - (=Contains)
[\s\S]*$
- match zero or more of ANY
character (including newline) - will match the rest of text.
In short: If we don't find newline
characters, match everything.
Now replace
with an empty string.
Solution 2:
If you want to match lines that doesn't have any English characters, you can use this:
(?-m)^(?![\s\S]*[a-zA-Z])[\s\S]*$
Explanation:
(?-m)
- turn off the multiline
option (which is otherwise enabled).
^
- match from start of text
(?![\s\S]*[a-zA-Z])
- negative look ahead
for ANY
characters followed by an English character.
[\s\S]*$
- match zero or more of ANY
character (including newline) - will match the rest of text.
In short: If we don't find an English character, match everything.
Now replace
with an empty string.
` or what? – Poul Bak Oct 25 '22 at 12:01
` – Joe Oct 25 '22 at 12:04
` NOT `
`! The space and the slash do of course also matter. – Poul Bak Oct 25 '22 at 19:50