Im using OpenOffice and Notepad++.
Need to match around first 1000 symbols (or less) in text until end of the sentence (dot sign). For example:
"Once upon a time ... around 1000 symbols ... the end.",
Then you click next search and get match of another around 1000 symbols that ends with .
sign and so on.
I tried regex (?s).*
that matches everything and .{0,1000}
that stops when reaches line break.
I think I need something like .{0,1000}\.\n\r
or .{0,1000}\.\S\s
. I noticed that I need include things like e.g.
in the regex, otherwise it matches ...e.
and leaves g.
apart. How to do that?
You can use
(?s).{0,1000}[.?!…]\B
See the regex demo.
Details:
(?s)
- a DOTALL modifier, .
now matches line break chars.{0,1000}
- any 0 to 1000 chars[.?!…]\B
- a .
, ?
, !
or …
that is either at the end of string or that is followed with a non-word char.