[Solved] Using reg expressions to change font
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
[Solved] Using reg expressions to change font
Is there any way to use regular expressions to change the font (the color, for example) of the named pattern? I tired it on OO/LO but there doesn't seem to be a way to do it.
I tried it just no in both LO and OO, but can't figure out a way to do it. If I choose to change the font to the color red, for example, nothing happens. Is there a way to put in the replace box the pattern with the new color?
I tried it just no in both LO and OO, but can't figure out a way to do it. If I choose to change the font to the color red, for example, nothing happens. Is there a way to put in the replace box the pattern with the new color?
Last edited by Hagar Delest on Wed Dec 13, 2017 11:19 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
LO 5.2.3.3, OS X El Capitan
Re: using reg expressions to change font
Please upload an ODF type sample file here.
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.
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.
-
- Volunteer
- Posts: 255
- Joined: Tue Apr 18, 2017 8:23 am
- Location: Germany
Re: using reg expressions to change font
In general you don't need RegEx for that, only to select specific characters... See attachment:
You only have to Find All, then apply another font.
You can (!) additionally use RegEx as well (Search for: .*); I couldn't find any difference.
Please notice: There is also the option to find a style. If your text is defined by Character Styles so select that option - without that you can't find these characters...
You only have to Find All, then apply another font.
You can (!) additionally use RegEx as well (Search for: .*); I couldn't find any difference.
Please notice: There is also the option to find a style. If your text is defined by Character Styles so select that option - without that you can't find these characters...
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
on LinuxMint 20 - 21 Mate, W10-64 pro
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
Re: Using reg expressions to change font
No, I need regular expressions, because the pattern is the same but it has different characters, a time stamp. I'm using the mac versions if that makes any difference. What do you mean by character styles? I'm unfamiliar with that.
LO 5.2.3.3, OS X El Capitan
Re: Using reg expressions to change font
Have a look in the offline help - F1 - in the Writer section for character styles.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
Re: Using reg expressions to change font
either way it doesn't work -- when I use it in Word version as well, it won't change the color of the search for pattern.
LO 5.2.3.3, OS X El Capitan
-
- Volunteer
- Posts: 255
- Joined: Tue Apr 18, 2017 8:23 am
- Location: Germany
Re: using reg expressions to change font
More details!Straitsfan wrote:either way it doesn't work
Zizi64 wrote:Please upload an ODF type sample file here.
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
on LinuxMint 20 - 21 Mate, W10-64 pro
Re: Using reg expressions to change font
See [Tutorial] How to record a macro (and Regular Expressions) for help and links to documentation.
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.
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.
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.
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
Re: Using reg expressions to change font
Maybe I'm not being clear -- I know how to use regular expressions. The problem is that I simply want to change the color of whatever I've found. If I go into "Replace" and leave it blank, but change the color using the "Fonts" button it doesn't change the color of whatever has been found -- it deletes whatever has been found in the "Find" section of the dialog box. I don't have this problem when I use word.
Can anyone tell me how to simply change the color of text using "Find and Replace"? Is there any way to do it in AOO? Because if there is I don't know how.
Can anyone tell me how to simply change the color of text using "Find and Replace"? Is there any way to do it in AOO? Because if there is I don't know how.
LO 5.2.3.3, OS X El Capitan
Re: Using reg expressions to change font
For this kind of task, Find & Replace is not used to make changes to the formatting. Find & Replace is used only to *select* all the characters you want to re-color ("Find All"), then change the color in the usual way(s). The F&R dialog window is not "modal"; you can leave it open and still have access to all the usual formatting controls.
AOO4/LO5 • Linux • Fedora 23
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
Re: Using reg expressions to change font
So if i understand you correctly, I have to manually change the color for each instance found, yes? If that's the case, then they need to update this, because I can do exactly that in Word.
Or, is it possible to use F&R to copy what has been found into the "Replace" section in addition to changing the color of the text?
Or, is it possible to use F&R to copy what has been found into the "Replace" section in addition to changing the color of the text?
LO 5.2.3.3, OS X El Capitan
Re: Using reg expressions to change font
Sorry I wasn't clear. Clicking "Find All" will select every match in the document. When you then change the color by clicking the toolbar or applying a style, every matching span of characters will be changed, just as when you select text manually and then apply some formatting. (You can also make multiple selections manually.)
Just to make this concrete, here is a complete step-by-step example:
1) File > New > Text Document
2) Type: dt
Press F3. This inserts a paragraph of "dummy text".
3) Edit > Find & Replace
Search for: \ba\S+
Replace with: empty
Options/Match case: ON
Options/Regular expressions: ON
Click Find All
You should now have every word beginning with 'a' selected (26 of them).
4) On the toolbar, click the "Font Color" pop-up and select a color. All of the selcted words should change font color.
Just to make this concrete, here is a complete step-by-step example:
1) File > New > Text Document
2) Type: dt
Press F3. This inserts a paragraph of "dummy text".
3) Edit > Find & Replace
Search for: \ba\S+
Replace with: empty
Options/Match case: ON
Options/Regular expressions: ON
Click Find All
You should now have every word beginning with 'a' selected (26 of them).
4) On the toolbar, click the "Font Color" pop-up and select a color. All of the selcted words should change font color.
AOO4/LO5 • Linux • Fedora 23
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
Re: Using reg expressions to change font
That'll do it. Thanks.
Just curious -- what does the S mean in your pattern? It's not part of the expressions list.
Just curious -- what does the S mean in your pattern? It's not part of the expressions list.
LO 5.2.3.3, OS X El Capitan
-
- Volunteer
- Posts: 255
- Joined: Tue Apr 18, 2017 8:23 am
- Location: Germany
Re: Using reg expressions to change font
Straitsfan wrote:what does the S mean in your pattern?
https://en.wikipedia.org/wiki/Regular_expression wrote:\S Matches anything BUT a whitespace.
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
on LinuxMint 20 - 21 Mate, W10-64 pro
-
- Posts: 22
- Joined: Mon Sep 29, 2008 11:31 pm
Re: Using reg expressions to change font
Just curious again -- how did you know that? It's not in the list. I would have never known that.
LO 5.2.3.3, OS X El Capitan
Re: Using reg expressions to change font
Newer versions OO (and LibO) support "PCRE" regular expressions. If you Google that you'll get plenty of documentation for the details. The built-in documentation hasn't been updated, I suppose because there are already lots of other sources. The docs could at least point users to look at an outside source, I guess.
The documentation for the regex implementation used by OO/LO is here:
http://userguide.icu-project.org/string ... characters
Edit: PS: |
http://userguide.icu-project.org/string ... characters
AOO4/LO5 • Linux • Fedora 23
-
- Volunteer
- Posts: 255
- Joined: Tue Apr 18, 2017 8:23 am
- Location: Germany
Re: Using reg expressions to change font
Also of interest, but LibreOffice:
https://help.libreoffice.org/Common/Lis ... xpressions
and the details for writer:
https://wiki.openoffice.org/wiki/Docume ... _in_Writer
https://help.libreoffice.org/Common/Lis ... xpressions
and the details for writer:
https://wiki.openoffice.org/wiki/Docume ... _in_Writer
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
on LinuxMint 20 - 21 Mate, W10-64 pro