replacelibreofficelibreoffice-writer

How to replace uppercase letters by their lowercase counterparts?


I have a big text document in which suspension points are followed by a capital letter. It should be lowercase. Now I figured to use this expression in search & replace: …\ [:upper:] which works fine to find the parts I want to replace, but when I try to do that with …\ [:lower:] I pastes literally that expression rather than the same letter but lowercase. What am I doing wrong? Thanks!


Solution

  • You can't use [:lower:] this way, because it's only a pattern to match the search text; it doesn't affect or transform the matched text part.

    To solve your issue:

    1. Put the search pattern in round brackets. This makes the current matched text available for the replacement pattern.

    2. Reference the current match in the replacement pattern using $1 (assuming there's only one pair of round brackets in your search pattern);

    3. Tell LO Writer to use lower-case characters when replacing.

    Step by step (the following example will simply replace every upper-case letter by its lower-case counterpart):

    1. Open find/replace (CTRL+H or Menu Edit -> Find/Replace...)

    2. As search pattern, enter ([:upper:])

    3. Make sure that "Regular expressions" is selected in "Other Options";

    4. As replace pattern, enter $1 (this simply uses the complete current match as replacement);

    5. Still with cursor in the "Replace" input box, hit the Format... button; this will open the "Replace with Formatting" window.

    6. In the "Replace with Formatting" window, select "Font effects", and from "Effects" -> "Case", select "lowercase". Hit OK.

    7. Execute the Find/Replace.