Copy link to clipboard
Copied
I need to find last word of each paragraph. Also check lastword is <= 8 characters only( include special character, dot and numbers). Find and apply no break condition.
for example.
Common (may affect up to 1 in 10 pat):
- Severe kidney failure (this will be ascertained by your doctor through some specific blood test)
- Low levels of calcium in the blood.
Uncommon (may affect up to 1 in 100 patients):
how many mg of each tablet is in a bottle?
Each tablet contains 100 mg.
If you enter number of paragraphs or lines higher than 200 –the function will work but will produce only 200 paragraphs (10).
If you don't want to include closing punctuation in the character count of the last word I would add [[:punct:]]* which will find any punctuation if it exists (* is the zero or more times match), and maybe add \s* as well in case the original text has extraneous trailing whitespace, so the final code would look like
\s\K\S{1,8}[[:punct:]]*\s*$
This would still fail if there is whitespace before any ending punctuation.
Copy link to clipboard
Copied
Hi Peter Spier & Peter Kahrel,
Thanks for your help, now everything is working fine.