[Solved] Find & Replace: Upper Case words to Lower Case (+)

Discuss the word processor
Post Reply
clausisme
Posts: 24
Joined: Fri Mar 28, 2014 3:23 pm

[Solved] Find & Replace: Upper Case words to Lower Case (+)

Post by clausisme »

I've been looking for a way to change any words found in uppercase into lowercase + a symbol. For example NYPD to *nypd (this is a special rule used in braille where words like THIS are written like *this in most languages). I used * as an example of a special character.
Right now I just search with [A-Z][A-Z] (with match case), that finds me uppercase words with at least 2 letters and then I manually do the rest. Is there a way to do that automatically ?
Last edited by clausisme on Wed Mar 14, 2018 10:20 am, edited 1 time in total.
OpenOffice 4.01 on Windows 7
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Find & Replace: Upper Case words to Lower Case (+ a symb

Post by Zizi64 »

Use the Regular Expressions for finding the "uppercase words" with the "word boundary" option :

[:upper:]*\b

(check-in the RegEx option)
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Find & Replace: Upper Case words to Lower Case (+ a symb

Post by John_Ha »

See [Tutorial]How to record a macro (and Regular Expressions)

If your problem is solved please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
clausisme
Posts: 24
Joined: Fri Mar 28, 2014 3:23 pm

Re: Find & Replace: Upper Case words to Lower Case (+ a symb

Post by clausisme »

Ok so far I got this:

Search for
(\w)([A-Z]+)
Replace with
*$1$2

So I get
NYPD > *NYPD
And I would need:
NYPD > *nypd

The problem is I have no clue how to do the lowercase in the replace.
The one suggested before ([:upper:]*\b) would also select one letter words (not wanted) .
Last edited by clausisme on Tue Mar 13, 2018 2:25 pm, edited 1 time in total.
OpenOffice 4.01 on Windows 7
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Find & Replace: Upper Case words to Lower Case (+ a symb

Post by John_Ha »

Can you do it in two steps?

1 Find any word in upper case and add the * symbol.
2 Change all upper case words to lowercase. Or change all characters following the * symbol up to the space (or stop, comma etc) to lower case.

Regular expressions are universal and not confined to AOO. Just google for what you want and you almost certainly will find it - regular expressions change case finds Replacement Text Case Conversion

If your problem is solved please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Find & Replace: Upper Case words to Lower Case (+ a symb

Post by Zizi64 »

to the replace window:

*S0

and see the lowercase fomatting option in the topic:
viewtopic.php?f=7&t=71914
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
clausisme
Posts: 24
Joined: Fri Mar 28, 2014 3:23 pm

Re: Find & Replace: Upper Case words to Lower Case (+ a symb

Post by clausisme »

OK to sum up changing uppercase words like "NYPD" "OK" (at least 2 letters) to lower case works with this:

Search for:
(\w)([A-Z]+)
Replace with
$0

MatchCase-[ticked]
Format>Font Efects>Lowercase

And you can add a charater in the Replace before or after $0, like *$0* (this will make NYPD into *nypd*)

Thank you all for your help. :super:


I was looking around on that site regular-expressions.info and other places google found me they all said "\L" should work ... but it does not. So the regex in OpenOffice is different and sometimes non-intuitive things like Search for "[:lower:]" work, but Replace with "[:lower:]" does not.
OpenOffice 4.01 on Windows 7
Post Reply