I have a text long document and I noticed I have written some really long sentences. Usually with multiple commas. Is there a way to highlight sentences with more than 2 commas or by word or letter count so I don’t need to manually read and find these?
Try the following:
-
make sure you have installed the Alternative Search & Replace tool extension for LibreOffice.
-
using the tool, enter in
.*.{80,120}
into the search box within the tool. 80 is the minimum number of characters within a paragraph and 120 is the maximum. Adjust this as you wish. Test using the find button within the tool. -
once you are ready to make these visible, you can either apply a previously customised style as indicated below, or apply direct formatting. I recommend setting a character or paragraph style you like as all you need to do if you want to change this later across the whole document is modify the character style.
So, setup a new style first. Then pull up the alternate search tool and in the replace drop down menu, select “character style” – then select your character style. You then have option of clicking find next and replacing as you see fit, or you Δ just select replace all. (if replace all does work, you can try find all to select all instances then select replace all).
Some depictions of the tool are located in this post.
warning: sentences which have manually entered CR/LF carriage-returns/line feeds are not detected by this.
You can remove carriage returns
If this answer helped you, please accept it by clicking the check mark to the left and, karma permitting, upvote it. That will help other people with the same question. In case you need clarification, edit your question (not an answer) or comment the relevant answer.
That search can be done also with the built-in S&R tool. Be sure to activate the search with “regular expressions” and write in the search box
EDIT: the original expression ignored sentences at the beginning of a paragraph… fixed
EDIT 2: consider the case when sentences do not end with a dot, but with a question mark or exclamation point… if you write in Spanish and some sentences start with ¿
or ¡
, you’ll need more though about the expression.
EDIT 3: final version (I think)
(?<=^|[\.\?! ])[^[\.\?!]]{100,}[\.\?!]
This will look for a dot/question mark/exclamation point or the beginning of a paragraph, but will not select it, then look for a string with more than 100 characters (no upper bond) that are not a dot/question mark/exclamation point followed by a final dot, and will select all that.
With this, if you press “find all” all sentences with more than 100 characters will be selected.