faustf Posted February 24, 2017 Share Posted February 24, 2017 hi guys i have a text in this mode gel idb #gel#uv scarpe #scarpe#scarponi#boots vestiti i have a combo , listed only a word without # , if i choice in combobox the word scarpe , i want extract with regexp #scarpe#scarponi#boots i tryed with this regexp expression local $combo = GUICtrlRead($combobox1) $Combo\n(.*?)\n but not work , anyone can help me?? thankz Link to comment Share on other sites More sharing options...
Developers Jos Posted February 24, 2017 Developers Share Posted February 24, 2017 (edited) seriously @faustf, 953 posts and then still posting a question like this? Only partial information and no script to play with. Is it really too much to ask as it is not the first time we are giving you this hint? Jos Edited February 24, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
faustf Posted February 24, 2017 Author Share Posted February 24, 2017 but i ask only if expression of my regrexp is correct , you can substitute the variable with word gel idb #gel#uv scarpe #scarpe#scarponi#boots vestiti $Combo\n(.*?)\n to ----> scarpe\n(.*?)\n the question is: is correct the expression ?? because in my RegexBuddy , work , but in my script not work Link to comment Share on other sites More sharing options...
Developers Jos Posted February 24, 2017 Developers Share Posted February 24, 2017 (edited) So what is the big problem putting this in a small script to show what you want so people can use that to show you the correct way, because I for one am really not sure what you are asking! Jos Edited February 24, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rootx Posted February 24, 2017 Share Posted February 24, 2017 1 hour ago, faustf said: hi guys i have a text in this mode gel idb #gel#uv scarpe #scarpe#scarponi#boots vestiti i have a combo , listed only a word without # , if i choice in combobox the word scarpe , i want extract with regexp #scarpe#scarponi#boots i tryed with this regexp expression local $combo = GUICtrlRead($combobox1) $Combo\n(.*?)\n but not work , anyone can help me?? thankz If the question is, read and manipulate the combobox..... you first read the contents of the combo box in a for next loop, then use a if condition and add # where is necessary. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2017 Moderators Share Posted February 24, 2017 faustf, This is a close as I can get to what I think you are asking - no need for a RegEx at all: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $aList[] = ["gel", "#gel#uv", "scarpe", "#scarpe#scarponi#boots", "vestiti"] $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUISetState() $sComboData = "" For $i = 0 To UBound($aList) - 1 If StringLeft($aList[$i], 1) <> "#" Then $sComboData &= "|" & $aList[$i] EndIf Next GUICtrlSetData($cCombo, $sComboData) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo $sComboSel = GUICtrlRead($cCombo) For $i = 0 To UBound($aList) - 1 If StringInStr($aList[$i], "#" & $sComboSel & "#") Then MsgBox($MB_SYSTEMMODAL, "Selected", $aList[$i]) ExitLoop EndIf Next EndSwitch WEnd M23 faustf 1 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 Link to comment Share on other sites More sharing options...
faustf Posted February 24, 2017 Author Share Posted February 24, 2017 thankz Link to comment Share on other sites More sharing options...
mikell Posted February 24, 2017 Share Posted February 24, 2017 $string = "scarpe" $res = StringRegExp(FileRead("1.txt"), '#' & $string & '\N+', 3) If IsArray($res) Then Msgbox(0,"", $res[0]) faustf 1 Link to comment Share on other sites More sharing options...
iamtheky Posted February 24, 2017 Share Posted February 24, 2017 (edited) or for populating the combo #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include<array.au3> Global $aList[] = ["gel", "#gel#uv", "scarpe", "#scarpe#scarponi#boots", "vestiti"] $hGUI = GUICreate("Test", 500, 500) GUICtrlSetData(GUICtrlCreateCombo("", 10, 10, 200, 20), stringregexpreplace(_ArrayToString($aList) , "\|#.*?\|" , "|")) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited February 25, 2017 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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