Let’s assume a valid string consists of some sentences and has a maximum length of 10. A sentence ends with a dot and at least one whitespace character.
lol. omg rofl. => lol.
lol. omg. rofl. => lol. omg.
lol. => lol.
lol omg rofl. => no match
Any ideas?
Explanation:
^matches start of string.{,8}matches up to 8 chars (10 – specified 2 chars)\.matches literal dot and a spaceEdit: Oh, I missed the sentence contains at least 1 space. Hmm, let me think …
By looking at https://stackoverflow.com/a/1839379/498634 I think the following might work:
^start of string(?!.{11,})negative look-ahead for exclude strings longer than 10.* .*any sequence with at least one space\.literal dot and space