Jump to content

regexp questions


faustf
 Share

Recommended Posts

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

  • Developers

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

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

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

  • Developers

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

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

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...