[Solved] Writer - Find/Replace Any String (Asterisk in VBA)

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
REH-CAE-RPT
Posts: 14
Joined: Wed Jul 12, 2017 9:28 pm

[Solved] Writer - Find/Replace Any String (Asterisk in VBA)

Post by REH-CAE-RPT »

In Word/VBA, searching for an asterisk character with the wildcards selected will search for "Any string of characters, including space and punctuation characters - for example, 's*d' finds 'sad', 'started', and 'significantly altered'."
https://support.office.com/en-us/articl ... 08c6c779b7

Is there an equivalent find/replace function in LibreOffice Writer?
Last edited by RoryOF on Sun Nov 12, 2017 11:34 pm, edited 2 times in total.
Reason: Added green tick [RoryOF, Moderator]
LibreOffice 5.2.7.2 (x64) on Windows 7 Professional
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Writer - Find/Replace Any String (Asterisk in VBA)

Post by Villeroy »

1) OpenOffice 5.2.7.2 (x64) does not exist. You are using LibreOffice and there is no reason to be ashamed because of the blue color in this forum.
2) Before you start macro coding with this office suite, you should at least become familiar with what you are trying to hack upon. An excellent programmer who never used MS Word could not write good VBA macros for Word. Or did you post in the macro forum by mistake?

LibreOffice supports regular expressions instead of simple shell patterns. Any string of characters is .* where the point stands for any single character and the quantifier * stands for none, one, two, many of the preceeding. Regex .+ stands for at least one of any char. Regex .{2,6} stands for 2 to 6 of any char.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
REH-CAE-RPT
Posts: 14
Joined: Wed Jul 12, 2017 9:28 pm

Re: Writer - Find/Replace Any String (Asterisk in VBA)

Post by REH-CAE-RPT »

1) Oops. Changed. Thanks.

2) I am definitely not a programmer; more of a ... lazy find/replace enthusiast. I cobbled together macros in VBA/Word basically using an existing macro as a template. That's the extent of my expertise with this stuff.

Thanks; in this case I was able to use '^.*' as the 'Find', as I was trying to find a string (or whatever) from the beginning of each paragraph...
LibreOffice 5.2.7.2 (x64) on Windows 7 Professional
Post Reply