0

I'm using macOS version of Microsoft Word (2019).

Been doing my final uni project for the last 3 months. Ended up with doing quoting wrong all along

I used " in the entire document while should've used «

So I thought I could find and replace all the quotes with the default find-and-replace Word's function like so:

When I click "Replace All", the following popup appears:

enter image description here

But that's rather an evil lie. Word didn't replace anything even though it notifies the user otherwise.

I'll lose my mind replacing all the mess manually... Is there a way I can do it automatically?

Thanks in advance

8
  • 1
    Aside from it seemingly getting it wrong, are you sure you used non-smart quotes in your document? Presumably if you’re replacing quotes you’ll need to replace “test” with «test» [both being ’smart’] otherwise you’d end up with «test«
    – Tetsujin
    Mar 1, 2022 at 18:10
  • Yeah, I wasn't thinking about the «test« up until now...
    – Joe D
    Mar 1, 2022 at 18:11
  • The input of “test” with the output of «test» is the expected result
    – Joe D
    Mar 1, 2022 at 18:14
  • Workaround: Word DOCX format is a zipped archive. Try opening the archive, extract the file that contains text, use any text editor to search-and-replace. and then save back into the DOCX archive. Or try free LibreOffice Writer, libreoffice.org/get-help/install-howto/macos which can edit Word documents better than MS Word (for example, it can edit older version documents, no longer supported by MS). Mar 1, 2022 at 18:14
  • 1
    @JoeD You might need to make it a two run deal to keep it simplified. So use on the first run Find what: " and Replace with: #« and then when that run is complete, run a Find what: # and keep the Replace with: blank and null with no white space. If you have actual # symbols in the docs to not get replaced, use a different unique character in its place that will suffice (e.g. backtick, %, &, @, etc.). Let me know if this helps you get the task complete easily. Mar 1, 2022 at 18:43

1 Answer 1

2

There are two situations: you are using so-called “smart quotes” (default) or you have "regular quotes" (you disabled Word's automatic replacement of quotes for smartquotes). In either case, ensure that the options to ignore punctuation and whitespace are not enabled in the find and replace dialog!

I am using Word 2019 on the Mac so will use the mac's Option-key method to input the special characters in the instructions. On Windows, to type the special characters, hold down the Alt key and type a number on the numeric keypad: Alt+0145 and Alt+0146 for opening () and closing () single-quotes, and Alt+0147 and Alt+0148 for opening () and closing () double-quotes. For the guillements, use Alt+174 for («) and Alt+175 for (»). If you do not have a numeric keypad, use the character map utility (search for charmap in the start menu) In a Linux/Mac terminal, you can generate all these characters with printf '\u201c\n\u201d\n\u2018\n\u2019\n\uab\n\ubb\n'

For situation one: in the find and replace dialog, type Option+[ for opening double-smartquote () or Option+] for opening single smartquote () and then in the replace field type Option+\ for opening guillement («), appending a space as needed. You could also copy and paste from the document to get these special characters. This will take care of the opening quotes. Do the same for the closing ones using Option+Shift+[ () and Option+Shift+] () to search for the closing smartquotes and replace with Option+Shift+\ (») (prepend a space as needed) for the closing guillement.

For situation two: use the advanced find and replace dialog and enable the "use wildcards" checkbox. We need to use regular expressions (regex) to differentiate between an opening and closing quotation mark since they are the same actual character. For opening double-quotes, use "([a-zA-Z0-9]) and for opening single-quotes, use: '([a-zA-Z0-9]). In the replace box, for both, use: « \1. For the closing double-quotes and single-quotes, use ([a-zA-Z0-9.,\!‽\?])" and ([a-zA-Z0-9.,\!‽\?])' respectively in the find field and put, \1 » in the replace field. Read on for an explanation of these special search strings.

As a brief primer of regex, anything within parenthesis is captured into a numbered memory location and you recall that memory with \n The first paren maps to \1, the second to \2, etc... The square brackets are sort of a ? wildcard on steroids: instead of matching any one character, you can define exactly what characters match. Ranges are supported and here, you can see that we are matching (and storing) any alphanumeric character, upper or lower-case for the opening quotes. For closing quotes, we add certain punctuation which typically precede closing quotes. Note that the exclamation and question marks both are special characters in regex and so they are preceded by the backslash to indicate matching the actual character \! matches ! and \? matches ?. You may be unfamiliar with the interrobang character which denotes an exclamatory question; it is not a special character in regex and so doesn't need the backslash.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .