Jump to content
Sign in to follow this  
igorm

Search

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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
Sign in to follow this  

×
×
  • Create New...