In Word, I would like to use the regular expressions to match "Po" followed by either a whitespace or end of line character.

[[Po John

So in the above example I would like to match the bottom two items - "[[Po" and "[[Po" (without the John).

Ultimately what I am doing is an Intellisense - kind of VSTO. I can search through the text of the document to find what I am after with c# using real regular expressions, but where I hit the snag point is making the replacement and not losing any formatting. Hence using the .Replace word method.


I confirmed this solution on Word for Mac. Go to Edit->Find->Advanced Find and Replace. Pull up the advanced options, and select the Use wildcards checkbox.

Search on this: \[\[Po[^013 ]

The ^013 is the code for a carriage return.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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