Local $Str = _
'{' & @CRLF & _
' "browser": {' & @CRLF & _
' "clear_lso_data_enabled": true,' & @CRLF & _
' "pepper_flash_settings_enabled": true,' & @CRLF & _
' "window_placement": {' & @CRLF & _
' "bottom": 560,' & @CRLF & _
' "left": 10,' & @CRLF & _
' "maximized": false,' & @CRLF & _
' "right": 790,' & @CRLF & _
' "top": 10,' & @CRLF & _
' "work_area_bottom": 570,' & @CRLF & _
' "work_area_left": 0,' & @CRLF & _
' "work_area_right": 800,' & @CRLF & _
' "work_area_top": 0' & @CRLF & _
' }' & @CRLF & _
' },' & @CRLF & _
' "cloud_print": {' & @CRLF & _
' "email": ""' & @CRLF & _
' },' & @CRLF & _
' "sync": {' & @CRLF & _
' "suppress_start": true' & @CRLF & _
' }' & @CRLF & _
'}'
MsgBox(0, '原字符串', $Str)
MsgBox(0, '替换结果', _Replace('window_placement', 'bottom', 100))
MsgBox(0, '替换结果', _Replace('cloud_print', 'email', 'av@av.com'))
Func _Replace($s1, $s2, $sR = '')
Return StringRegExpReplace($str, '(?si)("' & $s1 & '"[^}]*?"' & $s2 & '":\h*"?)[^,"]*', '${1}' & $sR)
EndFunc ;==>_Replace
|