Trying to use regular expression in ms word see https://www3.ntu.edu.sg/home/ehchua/programming/howto/PowerUser_MSOffice.html
- How do I find all text "{text}" in the word document? This regular expression works in a text/regex \{(.*?)\} but it doesn't work in word.
- Also, is there a way to auto-format this with a style if found?
CodePudding user response:
In MS Word, the wildcards are somewhat limited in functionality and you cannot translate * quantifier exactly ({0,} does not work for some reason). So, what you can use is
(\{[!{}]@})
and replace with \1.
To apply some format or style, you need to select it in the left-hand bottom corner of the Search & Replace dialog window when your cursor is in the replacement text field.
Pattern details:
(- start of capturing group #1\{- a literal{char[!{}]@- one or more (@) chars other than{and}(matched with[!{}])}- a}char.
)- end of the group.
