Hello,
We think the problem is that you need to include all characters (<, >, :...), not only letters, numbers, _ ... as set in [A-Z0-9\s\-_]
If we try a more generic regex using your regex as base:
\{\{(?:#){0,1}(?:.)+\}\}
The placeholder in the XML is returned correctly.
Also note that this regular expression (and the new one you have posted) will match if you have {{ and }}, but MS Word may break them, for example:
<w:r>
<w:rPr>
<w:b w:val="false"/>
<w:bCs w:val="false"/>
</w:rPr>
<w:t>{</w:t>
</w:r>
<w:r>
<w:rPr>
<w:b w:val="false"/>
<w:bCs w:val="false"/>
</w:rPr>
<w:t>{USER</w:t>
</w:r>
<w:r>
<w:rPr/>
<w:t>_N</w:t>
</w:r>
<w:r>
<w:rPr>
<w:b w:val="false"/>
<w:bCs w:val="false"/>
</w:rPr>
<w:t>A</w:t>
</w:r>
<w:r>
<w:rPr/>
<w:t>ME}</w:t>
</w:r>
<w:r>
<w:rPr/>
<w:t>}</w:t>
</w:r>
A more generic regex would be:
\{(?:.)*\{(?:#){0,1}(?:.)+\}(?:.)*\}
The easiest approach is using a single symbol ($, |, @...) or the default ${ } to wrap placeholders; in these cases you don't need to change the default regex. But if you want to customize it using {{ }} or others such as {[ ]}, $[ ]$ then a generic regex such as the previous one must be generated.
Regards.