Hi All,
I'm trying to use the StringRegExpReplace function to replace a randomly placed string "data ignore value = unknown numbers", in multiple *my.txt files with "new stuff". I have been able to get it to replace everything before the wildcard, but the numbers after the wildcard are tacked onto "new stuff"
So...
What I want to change in the text file:
data ignore value = 4
data ignore value = 45
What I want:
new stuff
new stuff
What I currently get:
new stuff 4
new stuff 45
$myfolder = @scriptdir
If $myfolder <> "" Then
Local $hSearch = FileFindFirstFile($myfolder & "\*my.txt")
While 1
$sFileName = FileFindNextFile($hSearch)
If @error Then ExitLoop
$szFile = $sFileName
$szString = FileRead($szFile,FileGetSize($szFile))
$szString = StringRegExpReplace($szString, "data ignore value = *", "new stuff")
FileRecycle($szFile)
FileWrite($szFile,$szString)
Wend
FileClose($hSearch)
EndIf
Any help would be muchly appreciated.