faustf

regexp questions

9 posts in this topic

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

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

thankz

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now