s = rfp.ReadText Set regEx = New RegExp Set reg2 = New RegExp regEx.Pattern = "[#「([^「」]+)」に「([^「」]+)」の注記]" regEx.Global = True Set Matches = regEx.Execute(s) For Each Match in Matches d1 = regEx.Replace( Match.Value,"$1" ) d2 = regEx.Replace( Match.Value,"$2" ) d = d1+ Match.Value reg2.Pattern =d s = reg2.Replace( s , "<ruby><rb>"&d1&"</rb><rp>(</rp><rt>"&d2&"</rt><rp>)</rp></ruby>") Next wfp.WriteText s