Tormiasz Posted October 21, 2013 Posted October 21, 2013 (edited) Hello, I have this code: Local $aSearcher = 'gGuestServer = "None",' Local $aSearchString = 'gGuestServer = "(.*?)",' Local $aSavedGuestServer = StringRegExp($aSearcher, $aSearchString, 3) And it works well, finding the "None". But when $aSearcher will have several lines (from FileRead()), it can't find anything. I am sure there is this text, checked by ClipPut. What I am doing wrong? Tried also '(?m)gGuestServer = "(.*?)(?m)' Thanks for answers. Edited October 21, 2013 by Tormiasz
Moderators Melba23 Posted October 21, 2013 Moderators Posted October 21, 2013 Tormiasz,This seems to work: #include <Array.au3> Local $aSearcher = 'gGuestServer = "None"' & @CRLF & _ 'gGuestServer = "Tom"' & @CRLF & _ 'gGuestServer = "Dick"' & @CRLF & _ 'gGuestServer = "Harry"' Local $aSearchString = 'gGuestServer\s=\s\x22(.*)\x22' Local $aSavedGuestServer = StringRegExp($aSearcher, $aSearchString, 3) _ArrayDisplay($aSavedGuestServer) ; And you can make the search pattern much simpler Local $aSearchString = '\x22(.*)\x22' Local $aSavedGuestServer = StringRegExp($aSearcher, $aSearchString, 3) _ArrayDisplay($aSavedGuestServer)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Solution Tormiasz Posted October 21, 2013 Author Solution Posted October 21, 2013 (edited) I found my bad... Used Same name for variable and a argument, it's forbidden with stringregexp. Edited October 21, 2013 by Tormiasz
gruntydatsun Posted October 21, 2013 Posted October 21, 2013 question for melba, why did you use the hex22 to represent the " ?
Moderators Melba23 Posted October 21, 2013 Moderators Posted October 21, 2013 gruntydatsun,Because I use the double quote as a string delimiter when I code - so I cannot use it inside a RegEx pattern. Just force of habit really. And before you mention that I did not do this in the code above - that was a straight copy-paste from the OP. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Tormiasz Posted October 21, 2013 Author Posted October 21, 2013 Ehh.. It's still not working after the change. IDK what is causing the problem.
Moderators Melba23 Posted October 21, 2013 Moderators Posted October 21, 2013 Tormiasz,Please post the code that does not work. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Tormiasz Posted October 21, 2013 Author Posted October 21, 2013 (edited) Local $aAccountName1 = _Crypt_HashData($accounts[$aBotNumber - 1][0], $CALG_MD5) Local $aAccountName = StringLower(StringTrimLeft($aAccountName1, 2)) & "_settings.lua" Local $aWriteToMinion = @ScriptDir & "\LuaMods\gw2minion\" & $aAccountName Local $aSearcher = FileRead($aWriteToMinion) Local $aSearchString = 'gGuestServer\s=\s\x22(.*)\x22' Local $aSavedGuestServer = StringRegExp($aSearcher, $aSearchString, 3) Local $aOldGuestServer = IniRead("config.ini", "GUESTSERVER", $aGetParty, "0") If $aSavedGuestServer[0] <> $aOldGuestServer Then Local $sOldGuestServer = 'gGuestServer = "' & $aSavedGuestServer[0] Local $sNewGuestServer = 'gGuestServer = "' & $aOldGuestServer _ReplaceStringInFile($aWriteToMinion, $sOldGuestServer, $sNewGuestServer) EndIf $aWriteToMinion is fine, I've checked it. Edited October 21, 2013 by Tormiasz
Moderators Melba23 Posted October 21, 2013 Moderators Posted October 21, 2013 Tormiasz, Local $aWriteToMinion = @ScriptDir & "\LuaMods\gw2minion\" & $aAccountNameGW2Minion:The Best and Safest Guild Wars 2 Bot on the marketSo you should not need 3 guesses to know what comes next. Please read the Forum rules (there is also a link at bottom right of each page) - particularly the bit about not discussing game interaction - before you post again. Then you will understand why you will get no more help and this thread will now be locked. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts