Joho the Blog » Microsoft Word does regex!

Microsoft Word does regex!

After literally decades of using Microsoft Word I just found out that it does regex!

I discovered this because I needed to delete comments inserted throughout my book manuscript, in the form . Hundreds of them. I was contemplating exporting to HTML so I could use a text editor that can handle this type of search and replace, but came across an article on how to use regular expressions in Word. Regexes let you use magical incantations that no one understands but that cause text to dance in little circles and transform themselves in puffs of smoke.

For example, to get rid of the pesky markup in my manuscript, I just had to tell the Replace dialogue to use wildcards, and then had it search for \<AU:?\>. The backslashes are necessary so that the angle brackets are not read as regex instructions. The question mark tells Word to find everything between <AU: and >. Simple! And it accepts far more complex regular expressions that. (Here’s a site that lets you test your regular expressions.)

Take a well deserved bow, Microsoft Word! (And then fix auto-numbers.)

Previous: « || Next: »

One Response to “Microsoft Word does regex!”

  1. Nice thoughts! Can you tell if this feature work in Word 2010. Also, please explain what needs to be fixed regarding auto-numbers?

Leave a Reply


Web Joho only

Comments (RSS).  RSS icon