$Str1 = _
'<?xml version="1.0" encoding="utf-8"?>' & @CRLF & _
'<StringBundle version="1.0">' & @CRLF & _
' <String id="AAA">AAA1</String>' & @CRLF & _
' <String id="BBB">BBB1</String>' & @CRLF & _
' <String id="CCC">CCC1</String>' & @CRLF & _
' <!-- PRODUCT_IPC_PLAT-->'
Msgbox(0, '原字符串', $str1)
$Str2 = _
'<?xml version="1.0" encoding="utf-8"?>' & @CRLF & _
'<StringBundle version="1.0">' & @CRLF & _
' <String id="AAA">甲甲1</String>' & @CRLF & _
' <String id="BBB">乙乙1</String>' & @CRLF & _
' <String id="CCC">丙丙1</String>' & @CRLF & _
' <!-- PRODUCT_IPC_PLAT-->' & @CRLF
Msgbox(0, '原字符串', $str2)
$s2 = StringRegExpReplace($str2, '(?s).+?(<String id.+?<!).+', '$1')
$str1 = StringRegExpReplace($str1, '(?s)<String id.+?<!', $s2)
Msgbox(0, '替换后', $str1)
|