How to replace all an all capitalized paragraph default style to a heading style

I have a very large file where the whole document is default style and the headings are all written with all caps. I want to search for all caps paragraphs in default style and replace them all with a heading style.

Seems to me this would be a common problem for folks who didn't think about styles but were wise enough to make headings special or recognizable.

edit retag close merge delete

Sort by » oldest newest most voted

It's possible doing some RegExp magic. For languages that distinguish between uppercase and lowercase, Unicode has a "tag" to distinguish both cases. Let's suppose that only on the paragraph you want transform into headings you'll find words with two or more consecutive uppercase characters, then

1. Open the full search & replace tool with Ctrl H
2. Check the option to distinguish lowercase from uppercase (it's just below the search box)
3. Check the option to use regular expressions (it's under "more options")
4. On the search box type (\p{Lu}){2,}
5. Click on "Find all"
6. Alt TAB to return the focus to the document and then Ctrl 1 to apply the Heading 1 paragraph style

Done.

I wrote an introduction to Regular Expressions (even if this particular topic is not considered there) in my free book about Writer.

more