igorm Posted December 19, 2007 Share Posted December 19, 2007 Hi, I need to perform a search which will return me as result found match + one next character. Here is part of my script that finds only desired word: $path24 = GUICtrlRead($input2) $inifilelisthree = _FileListToArray($path24 & '\FILES\SETUP','setup*.ini',1) $inifilethree = $path24 & '\FILES\SETUP\'&$inifilelisthree[1] $selecteditem = _GUICtrlListView_GetSelectedIndices($list1, True) If $selecteditem[0] = 0 Then Else For $i=1 To $selecteditem[0] $getinfo = _GUICtrlListView_GetItem($list1, $selecteditem[$i]) $search = StringRegExp ($getinfo[3], "ChainedInstall_", 2) $covertsearch = _ArrayToString($search, "|") As return here I will get "ChainedInstall_", but I need as return "ChainedInstall_+one next character". Can somebody help me please? Thanks. Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 19, 2007 Share Posted December 19, 2007 Hi, I need to perform a search which will return me as result found match + one next character. Here is part of my script that finds only desired word: $path24 = GUICtrlRead($input2) $inifilelisthree = _FileListToArray($path24 & '\FILES\SETUP','setup*.ini',1) $inifilethree = $path24 & '\FILES\SETUP\'&$inifilelisthree[1] $selecteditem = _GUICtrlListView_GetSelectedIndices($list1, True) If $selecteditem[0] = 0 Then Else For $i=1 To $selecteditem[0] $getinfo = _GUICtrlListView_GetItem($list1, $selecteditem[$i]) $search = StringRegExp ($getinfo[3], "ChainedInstall_", 2) $covertsearch = _ArrayToString($search, "|") As return here I will get "ChainedInstall_", but I need as return "ChainedInstall_+one next character". Can somebody help me please? Thanks. Cheers Just add a dot to the pattern (matches any single character). Also, type 2 only returns a single match, so I changed it to type 3 to get all global matches: #include <array.au3> $sString = "ChainedInstall_1 | ChainedInstall_2 | ChainedInstall_3 " $search = StringRegExp($sString, "ChainedInstall_.", 3) _ArrayDisplay($search, "Debug: $search") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
igorm Posted December 19, 2007 Author Share Posted December 19, 2007 Thanks. Works like a charm. Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
igorm Posted December 20, 2007 Author Share Posted December 20, 2007 One more question. Can I somehow extract just this one character into variable? Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 20, 2007 Share Posted December 20, 2007 One more question. Can I somehow extract just this one character into variable? That would be a Lookbehind Assertion: "(?<=ChainedInstall_)." #include <array.au3> $sString = "ChainedInstall_1 | ChainedInstall_2 | ChainedInstall_3 " $search = StringRegExp($sString, "(?<=ChainedInstall_).", 3) _ArrayDisplay($search, "Debug: $search") New trick I just picked up in other topics on this forum... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
igorm Posted December 20, 2007 Author Share Posted December 20, 2007 Wow, this is really cool. Thank you very much again. This will help me a lot. Cheers Office 2000/XP/2003/2007 Slipstreamer 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