次の正規表現を使用して、Word 文書で megefields を見つけることができます
EX: <<SAMPLEMERGEFIELD>>
private static readonly Regex instructionRegEx =
new Regex(
@"^[\s]*MERGEFIELD[\s]+(?<name>[#\w]*){1}
[\s]*(\\\*[\s]+(?<Format>[\w]*){1})?
[\s]*(\\b[\s]+[""]?(?<PreText>[^\\]*){1})?
[\s]*(\\f[\s]+[""]?(?<PostText>[^\\]*){1})?",
RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
このようにIF条件内にあるマージフィールドを見つける方法
{=IF(<<MERGEFIELD>> >= 100,10,0)}