1

I have a 150-page reference file (a Microsoft Word document) where the dates are in British (dd Mmmm yyyy) format and I'd like them in American (Mmmm dd, yyyy) format.  Is it possible to use wildcards to search and replace and transpose all instances of:

  • "dd Mmmm yyyy" to "Mmmm dd, yyyy"; e.g., 1 December 2001 to December 1, 2001

  • "dd Mmmm." to "Mmmm dd."; e.g., 1 December. to December 1.

1
  • There is a need for the file I am working on to change the formats. What I've described is exactly what I'm trying to accomplish. Appreciate any help anyone can give me. I have found [0-9]{1,2} <[AFJMNSOD]*> which will find the DD MM and select it, I just haven't found what wildcards I'd use to transpose them and add a comma(,) after the DD. Feb 11, 2019 at 15:43

1 Answer 1

1

I believe that this won’t be possible with a single search-and-replace in Microsoft Word.  It would be easier if you were dealing with a text file and you had access to GNU/Unix tools like sed; but I’ll answer the question you asked.

  1. Identify a character or sequence (string) of characters that never appears in your document.  Do not use any of the characters (, ), [, ], {, }, <, >, @, ^, *, \, ? and !.  For an ordinary document (i.e., one that isn’t about computer stuff), | may suffice.  If you have that in your document, try something like |foo|, ### or %%%.  I’ll assume that | works for you.

  2. In Word’s “Find and Replace” dialog (type Ctrl+H),

    • Click on the “More >>” button, and
    • Check the “Use wildcards” option.
  3. Then enter

    • “<([0-9]{1,2}) (January)>” in the “Find what” box, and
    • “\2 \1|” in the “Replace with” box,

    and click on “Replace All”.

  4. Change “January” to “February” and click on “Replace All” again.  Repeat for each month.

  5. Enter “|␣” in the “Find what” box and “**,**␣” in the “Replace with” box (where ␣ represents a space), and click on “Replace All”.

  6. Change the “Find what” box to just “|” (delete the space), delete the contents of the “Replace with” box, and click on “Replace All” again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.