Find/Replace: separate capital strings on new line?


I have regular and ALT find/replace extension

I need to find all strings in a large text document for my course.

THere are many strings with CAPITAL LETTERS suggesting headlines

Is there a way to put all capital letter strings onto their own lines with line break or anything?


I tried your instructions to the letter and:

No matches found!?

What could I be doing wrong? :slight_smile:

You didn’t tick the Regular expressions box.

1 Like

Note: This will not find titles that begin with one letter words (i.e., A, I) and a few more special cases (i.e., titles after a question mark).

Find: ([a-z]|\.) ([A-Z]{2,}), and replace with: $1\n$2.
Check [x] Match case and [x] Regular expressions

Version and

Find: \s?+(\b(([A-Z]+\s*\b))+)(\s[a-z])?+, and replace with: \n$1\n$4.
Still there are problems with Manual Row Breaks and points or other symbols at the end of the sentence.

See some on ICU’s Regular Expressions.

1 Like

Did not function for strings like this: “STRUCTURE AND FUNCTION” hidden inside a block of text :frowning:

With double quotes? Edit your question and share a reduced sample file to test. Thanks.

no, not with double quotes :slight_smile:

Yes I did tick “regular expressions” :slight_smile:

The failure comes from the regular expression. As such, it will find only <lower_case_letter_or_dot> followed by a sequence of UPPER_CASE_LETTERS. Your sequence contains spaces.

It does not matter if the newline is to be inserted before STRUCTURE, provided this is preceded by a lower case letter or a dot. If this “starting marker” is not present, the regexp fails.

IMHO, such a text restructuring should not be done inside Writer, but outside with a powerful macro generator such as awk or m4 (or others) where the matching criteria (plural because these tools are capable of simultaneous trials with several regexp) can be sophisticated enough to encompass all cases.

Try this (regular expressions needed):
[x] Match case



Finds words in capitals and a range of words in capitals, spaces included… HTH
Cannot find “capitals” which are formatted characters UPPERCASE.
Cannot match single capitals like in THIS IS A TEST.
Thanks to @LeroyG - basically excellent idea!