Page 1 of 1

[Solved] How to enter ASCII codes in Find / Replace dialog?

PostPosted: Wed Aug 14, 2019 9:14 pm
by Cardinal2B
I'm hunting ellipses (3 dots that are one character) and replacing them with 3 periods. I have to do this a lot thanks to AutoCorrect. I've turned that off, but have lots of them I have to find in existing documents.
Of course, you can't spot them just by opening the document and looking.
So, I'd like to open a document, open a Find/Replace dialog, type in the ascii code 133 somehow, and type in 3 periods in the Replace with box, and Replace All.
I know I could copy an ellipsis from the document and paste it into the Find box, but I reaqlly want to type in the ascii code.
How do I do that?
I've tried carats, and U and \u and Ctl+Alt all to no avail...
what am I missing? what are the exact keystrokes I need?
Thanks!

Re: how to enter ascii codes in Find / Replace dialog?

PostPosted: Wed Aug 14, 2019 9:29 pm
by RoryOF
As far as I know, you can't. Copy and Paste is the way.

 Edit: One could use AltSearch from the extensions repository, which can be driven from a batch file; however, AltSearch syntax takes some mastering, so it might be quicker to make a file with the ellipsis and the replacement three dots, copy from that into Find and Replace into your target files, and use Replace all button. 

Re: how to enter ascii codes in Find / Replace dialog?

PostPosted: Wed Aug 14, 2019 10:51 pm
by Lupp
Thats not an ASCII code. The unicode place is U+2026.
You can search for this character with regular expressions in F&R entering \u2026 in any place of the SearchString. Same way it works with any unicode character whose CodePlace has 4 hex digits.
The ReplaceString does not accept this coding.
(It works with V4.1.5 of AOO - and in LibO for a long time now. I don't remember for which version of AOO it was implemented first. I would suppose it was an update of the ICU RegEx engine which brought it. But even in LibO the otherwise there usable Alt+X command for CodePointNumberHex<-->Character replacement does not work in F&R)

Re: how to enter ascii codes in Find / Replace dialog?

PostPosted: Wed Aug 14, 2019 11:00 pm
by RoryOF
Thank you for that, Lupp. Note that on my OO, Regular Expressions needs to be checked (on More Options dropdown). It does not work in the Replace box - the string is treated as a literal.

Re: How to enter ASCII codes in Find / Replace dialog?

PostPosted: Fri Aug 16, 2019 4:06 pm
by Cardinal2B
Lupp thanks very much! Obviously I am operating above my knowledge level here with regard to these codes!
BUT with the Regular Expressions box checked as RoryOF noted, I was able to type
\u2026
in the Search for box, then specify what to Replace with, click Replace All and voila!~
Excellent! Thank you very much! :bravo:

Re: How to enter ASCII codes in Find / Replace dialog?

PostPosted: Fri Aug 16, 2019 4:09 pm
by RoryOF
Note that the unicode will not work in the Replace box; if you need a unicode character as the Replace, you will have to Copy and Paste it there (Ctrl C, Ctrl V)