Jump to content

Search the Community

Showing results for tags '_arrayfindallex'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I have a program that logs uninstall keys for programs and adds them to a csv It has an exemption array of programs i don't want include in the list, but its getting a bit out of hand. Is there a way to use wildcards to remove things from an array? example of the remove array $sRemoveArray &= '|Update for 2007 Microsoft Office System (KB967642)|Update for Microsoft Office 2007 Help for Common Features (KB963673)|Update for Microsoft Office 2007 suites (KB2596620) 32-Bit Edition|Update for Microsoft Office 2007 suites (KB2596787) 32-Bit Edition|Update for Microsoft Office 2007 suites (KB2767849) 32-Bit Edition'If i could use $sRemoveArray &= '|Update for 2007 Micr*'I could remove 3 bloody great big array just on that one alone I remove the items like this For $removeloop = 1 To UBound($aRemoveArray) - 1 $search = _ArraySearch($aList, $aRemoveArray[$removeloop]) ; Look for the index of the item ;~ ConsoleWrite($search & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF) If $search <> -1 Then ; If found... _ArrayDelete($aList, $search) ; ...then remove it EndIf NextI looked at this because i thought it would maybe do it, but im struggling to make sense of it in relation to deleting array lines #include <Array.au3> Local $aTest_Array[3] = ['Testing`_Temp.jpg', 'JOHN.jpeg', 'Boshe.jpeg'] Local $Ret_Array $Ret_Array = _ArrayFindAllEx($aTest_Array, '*_Temp.jp?g|*h?.jp?g', True, 'Test*.jp?g|b*.jpeg', False) _ArrayDisplay($Ret_Array, @extended & ' Match') #cs Wildcards * - Zero or more character + - One or more character ? - No or one character #ce ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayFindAllEx ; Description ...: Similar to _ArrayFindAll with Include, Exclude masks ; Syntax ........: _ArrayFindAllEx(Const Byref $aArray, $sIncludeMask[, $fIncSenstive = True[, $sExcludeMask = ''[, ; $fExcSenstive = True]]]) ; Parameters ....: $aArray - [in/out and const] The Array to search for the values. ; $sIncludeMask - A string value. ; $fIncSenstive - [optional] A boolean value. Default is True. ; $sExcludeMask - [optional] A string value. Default is ''. ; $fExcSenstive - [optional] A boolean value. Default is True. ; Return values .: Sucess - Returns the array of the Index of the found values ; - @extended is set to the number of items found ; Failure - Returns '' and sets @error to 1 ; Author ........: Phoenix XL ; Modified ......: ; Remarks .......: ; Related .......: _ArrayFindAll ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _ArrayFindAllEx(ByRef Const $aArray, $sIncludeMask, $fIncSenstive = True, $sExcludeMask = '', $fExcSenstive = True) ;Set Sensitivity Values If $fIncSenstive Then $fIncSenstive = '' Else $fIncSenstive = '(?i)' EndIf If $fExcSenstive Then $fExcSenstive = '' Else $fExcSenstive = '(?i)' EndIf ;Make the Include Mask Pattern $sIncludeMask = StringRegExpReplace($sIncludeMask, '(?s)([^\w|])', '[\1]') $sIncludeMask = StringRegExpReplace($sIncludeMask, '(?s)(\[\?\])', '.?') $sIncludeMask = StringRegExpReplace($sIncludeMask, '(?s)(\[\+\])', '.+') $sIncludeMask = $fIncSenstive & '(?s)\A(' & StringRegExpReplace($sIncludeMask, '(?s)(\[\*\])', '.*') & ')\z' Local $aRet[1] ;Debug Out Include Mask Patterns ;~ ConsoleWrite($sIncludeMask & @CR) ;Get the to-include Strings For $i = 0 To UBound($aArray) - 1 If StringRegExp($aArray[$i], $sIncludeMask) Then _ArrayAdd($aRet, $i) Next _ArrayDelete($aRet, 0) If Not IsArray($aRet) Then Return 0 If Not $sExcludeMask Then Return SetExtended( UBound( $aRet ), $aRet ) ;Make the Exclude Mask Pattern $sExcludeMask = StringRegExpReplace($sExcludeMask, '(?s)([^\w|])', '[\1]') $sExcludeMask = StringRegExpReplace($sExcludeMask, '(?s)(\[\?\])', '.?') $sExcludeMask = StringRegExpReplace($sExcludeMask, '(?s)(\[\+\])', '.+') $sExcludeMask = $fExcSenstive & '(?s)\A(' & StringRegExpReplace($sExcludeMask, '(?s)(\[\*\])', '.*') & ')\z' ;Debug Out Exclude Mask Patterns ;~ ConsoleWrite($sExcludeMask & @CR) Local $nDeleted = 0 ;Delete the to-exclude strings For $i = 0 To UBound($aRet) - 1 If StringRegExp($aArray[$aRet[$i - $nDeleted]], $sExcludeMask) Then $nDeleted += Number(_ArrayDelete($aRet, $i - $nDeleted) > 0) Next ;Done Return SetError(Not IsArray($aRet), UBound($aRet), $aRet) EndFunc ;==>_ArrayFindAllEx
×
×
  • Create New...