0

So my question is about regular expressions in Mac Word 2011. I have the following phrases that need to be found within a document and would like to get rid of them all at once. Examples: [set C/G, V icons] [set RF/R icon]

So basically, they all start with "[set " and end with "]". What is the regex required for what's left in order to highlight them all?

I was also wondering what the regex is for a sentence that ends with ")" and I want to change it to "]". Example: [The brown fox jumped over the lazy dog.)

3
  • I googled "Mac Word 2011 regex" and ended up with these current pages: office.microsoft.com/en-us/frontpage-help/…, office.microsoft.com/en-gb/word-help/…. I have tried [set \w just to see if it would highlight anything and it didn't. I have also tried a-zA-Z without any luck.
    – Crystal
    Oct 28, 2014 at 17:45
  • <quote> I was also wondering what the regex is for a sentence that ends with ")" and I want to change it to "]". Example: [The brown fox jumped over the lazy dog.) </unquote>. Is that not Find ")" replace with "]" ?
    – Prasanna
    Oct 28, 2014 at 17:50
  • Yes, but I don't want to have to search and replace, I want to be able to replace all without worrying that it replaces all of the ")". There are ")" in the document that need to stay as they are.
    – Crystal
    Oct 28, 2014 at 17:54

1 Answer 1

1

So anywho, I eventually managed to crack the case of the Word:mac 2011 regex case. This is for anyone out there who might eventually have something similar and hopefully this will be of some help to you.

The example: [set C/G, V icons] [set RF/R icon]

That good stuff was splattered all over the documents I'm working on, and I'm talking about thousands of these annoying little instances.

Solution: Insert into Find

\[set [a-zA-Z]*?*\]

Right there, that rough-around-the-edges regex solution, simply type that into the search and click replace all, and it should delete everything, as long as there is nothing in the replace.

As for the example: [The brown fox jumped over the lazy dog.)

That was special. There were a lot of sentences that had the wrong end-parenthesis.

Solution: Insert into Find

(\[[a-zA-Z]*?*)\)

Insert into Replace

\1]

So there you go stranger. Hopefully that helps.

Helpful sites that assisted in this discovery:

You must log in to answer this question.

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