Malkey Posted April 17, 2016 Share Posted April 17, 2016 This example matches the first two occurrences of "85C0741A68??????1068??????1068??????108BC8E8", then, only on the third occurrence, replaces "85C0741A68" in "85C0741A68??????1068??????1068??????108BC8E8" with "85C0EB1A68". You should be able to figure out the RE pattern by studying the StringRegExp and StringRegExpReplace functions in the Autoit help file. #include<array.au3> $data = "abc85C0741A68??????1068??????1068??????108BC8E8w " & _ "def85C0741A68??????1068??????1068??????108BC8E8x " & _ "gfi85C0741A68??????1068??????1068??????108BC8E8y " & _ "jkl85C0741A68??????1068??????1068??????108BC8E8z " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " & _ "85C0741A68??????1068??????1068??????108BC8E8 " ;$p = StringRegExpReplace($data, "^.*?(85C0741A68.{6}1068.{6}1068.{6}108BC8E8.*?85C0741A68.{6}1068.{6}1068.{6}108BC8E8.*?)(85C0741A68)(.{6}1068.{6}1068.{6}108BC8E8)", "${1}85C0EB1A68${3}") ; Or Local $iReplaceOccurrenceNumber = 3 $p = StringRegExpReplace($data, "^(.*?(?:85C0741A68.{6}1068.{6}1068.{6}108BC8E8.*?){" & $iReplaceOccurrenceNumber - 1 & "})(85C0741A68)(.{6}1068.{6}1068.{6}108BC8E8)", "${1}85C0EB1A68${3}") ConsoleWrite($p & @LF) Nubie 1 Link to comment Share on other sites More sharing options...
Nubie Posted April 18, 2016 Author Share Posted April 18, 2016 @iamtheky, with your way, the problem at how can put back old its position in that string? @Malkey , Thanks very much, it's correct what I want. My brain giving up ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now