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

Creating a macro - Writing a Script - Using the API

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

Postby REH-CAE-RPT » Sun Nov 12, 2017 8:46 pm

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/article/Find-and-replace-text-and-other-data-in-a-Word-document-c6728c16-469e-43cd-afe4-7708c6c779b7

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
REH-CAE-RPT
 
Posts: 14
Joined: Wed Jul 12, 2017 9:28 pm

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

Postby Villeroy » Sun Nov 12, 2017 9:18 pm

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24652
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby REH-CAE-RPT » Sun Nov 12, 2017 11:03 pm

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
REH-CAE-RPT
 
Posts: 14
Joined: Wed Jul 12, 2017 9:28 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests