jchd Posted February 28, 2020 Share Posted February 28, 2020 Aim at a moving target to make time pass away fast 😉 mikell 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jchd Posted February 28, 2020 Share Posted February 28, 2020 ... and patience! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Deye Posted February 28, 2020 Share Posted February 28, 2020 (edited) @unrealistic requests (realistic now 😄) $patt = "\w+(?=.exe)\.\w{3}" _ArrayDisplay(StringRegExp($txt, '.*\w+ ' & $patt & '(*SKIP)(?!)|' & $patt, 3))  Edited February 28, 2020 by Deye Link to comment Share on other sites More sharing options...
youtuber Posted February 28, 2020 Author Share Posted February 28, 2020 @mikell Your pattern returns two .exe.exe Testasdf!^+%&()=_ .exe.exe Testblabla!^+%&()=_.exe.exe  This is the better working solution for me. but it won't work if an exe name looks like this Testasdf!^+%&()=_.exe #include <File.au3> Local $FileSearch = _FileListToArray(@ScriptDir & "\", "*.exe", 1) If Not @error Then For $i = 1 To $FileSearch[0] ;but it won't work if an exe name looks like this Testasdf!^+%&()=_.exe $aRegex = StringRegExp($FileSearch[$i], '(?i)([^"]+)(?=.exe)\.\w{2,3}', 3) If IsArray($aRegex) Then _ChangeEXEnameINau3($aRegex[0]) EndIf Next EndIf Func _ChangeEXEnameINau3($aFileNameExe) Local $aFileList = _FileListToArray(@ScriptDir & "\MyprojectAu3\", "*.au3", 1) If Not @error Then For $i = 1 To UBound($aFileList) - 1 $Au3_path = @ScriptDir & "\MyprojectAu3\" & $aFileList[$i] $Read = FileRead($Au3_path) $sRegexRep = StringRegExpReplace($Read, '[^"]+(?=\.exe"(?:\h|\)))', $aFileNameExe) $Open = FileOpen($Au3_path, 2) FileWrite($Open, $sRegexRep) FileClose($Open) Next EndIf EndFunc ;==>_ChangeEXEnameINau3  Link to comment Share on other sites More sharing options...
Deye Posted February 28, 2020 Share Posted February 28, 2020 just add more combos they are supported $patt = "\w+(?=.exe)\.\w{3}" _ArrayDisplay(StringRegExp($var, '.*\w ' & $patt & '(*SKIP)(?!)|' & $patt &'|\w+[ -_]+(?=.exe)\.\w{3}', 3))  Link to comment Share on other sites More sharing options...
youtuber Posted February 28, 2020 Author Share Posted February 28, 2020 (edited) Thank you all Exactly like I want #include <File.au3> Local $FileSearch = _FileListToArray(@ScriptDir & "\", "*.exe", 1) If Not @error Then For $i = 1 To $FileSearch[0] $aRegexRep1 = StringRegExpReplace($FileSearch[$i], '^.*\\|\.[^.]*$',"") _ChangeEXEnameINau3($aRegexRep1) Next EndIf Func _ChangeEXEnameINau3($aFileNameExe) Local $aFileList = _FileListToArray(@ScriptDir & "\MyprojectAu3\", "*.au3", 1) If Not @error Then For $i = 1 To UBound($aFileList) - 1 $Au3_path = @ScriptDir & "\MyprojectAu3\" & $aFileList[$i] $Read = FileRead($Au3_path) $bRegexRep2 = StringRegExpReplace($Read, '[^"]+(?=\.exe"(?:\h|\)))', $aFileNameExe) $Open = FileOpen($Au3_path, 2) FileWrite($Open, $bRegexRep2) FileClose($Open) Next EndIf EndFunc ;==>_ChangeEXEnameINau3 Â Â Edited February 28, 2020 by youtuber Link to comment Share on other sites More sharing options...
mikell Posted February 28, 2020 Share Posted February 28, 2020 4 minutes ago, youtuber said: Exactly like I want Hurray !    youtuber 1 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