Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/24/2022 in Posts

  1. This isn't exactly an anchor question, but simply a question of satisfying the pattern, backtracking and restarting the pattern after a failure. |1a2a3c4c5c6 |(?U)a[^a]*c Option is parsed once |1a2a3c4c5c6 (?U)|a[^a]*c 1 doesn't match a in pattern 1|a2a3c4c5c6 (?U)|a[^a]*c a matches 1a|2a3c4c5c6 (?U)a|[^a]*c 2 matches [^a]* 1a2|a3c4c5c6 (?U)a[^a]*|c not followed by c in subject : pattern failed backtrack to 2 and restart pattern from there 1a|2a3c4c5c6 (?U)|a[^a]*c 2 doesn't match a 1a2|a3c4c5c6 (?U)|a[^a]*c a3c matches a[^a]*c : success 1a2a3c|4c5c6 (?U)a[^a]*c|
    2 points
  2. "the regex engine is eager to return a match" (Jan Goyvaerts)
    2 points
  3. This is my experiment to achieve multi-threading in AutoIt 😅 Source code, usage and examples in this github repo: https://github.com/nomi-san/true-autoit-multi-threading
    1 point
  4. Thanks jchd So finally, it would be the same behavior as you just explained, when "33" and * are used. When the subject and pattern reach this state, everything before being the same as previously:  1a2a|33c4c5c6 (?U)a|[^a]*c  "The pattern expects 0 or more characters (not a) followed by c" and 33 rightly match that expectation : 1a2a33|c4c5c6 (?U)a[^a]*|c No vertical bar between 3's lol... ... or why not, something like that during the possible "multicharacter checking phase", moving one vertical bar to the right (in subject) but not the other vertical bar (in pattern) until the checking phase ends : 1a2a3|3c4c5c6 (?U)a|[^a]*c Glad we have you here
    1 point
  5. jchd

    Regex selects all at start.

    No problem. When the subject and pattern reach this state, everything before being the same as previously: 1a2a|33c4c5c6 (?U)a|[^a]{2}c the pattern expects 2 characters not a and 33 rightly match that expectation. 1a2a33|c4c5c6 (?U)a[^a]{2}|c then the pattern requires c and we have a match as well with the string a33c.
    1 point
  6. Subz

    List all users in AD

    This is normally what I use to get account expiry date: #include <AD.au3> _GetUsers() Func _GetUsers() _AD_Open() If @error Then Exit MsgBox(16, "Active Directory Error", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ; Search all of AD for contractors and exclude _DT accounts. $aUserObjects = _AD_GetObjectsInOU("", "(&(objectcategory=person)(objectclass=user) (!(sAMAccountName=*_dt)(|(title=*contractor*) (title=*consultant*)(description=*contractor*) (description=*consultant*))))", 2, "sAMAccountName,accountExpires") For $i = 0 To UBound($aUserObjects) - 1 If IsObj($aUserObjects[$i][1]) Then $aUserObjects[$i][1] = _GetADDateTime($aUserObjects[$i][1], 1) Next _ArrayDisplay($aUserObjects) _AD_Close() EndFunc ;==>_GetUsers Func _GetADDateTime($_oADObject, $_iFlag = 0) Local $sAD_DTStruct, $sTemp3 If $_iFlag = 1 Then If $_oADObject.LowPart = -1 Then Return 0 If $_oADObject.LowPart > 0 And $_oADObject.HighPart > 0 Then $sAD_DTStruct = DllStructCreate("dword low;dword high") DllStructSetData($sAD_DTStruct, "Low", $_oADObject.LowPart) DllStructSetData($sAD_DTStruct, "High", $_oADObject.HighPart) $sAD_Temp = _Date_Time_FileTimeToSystemTime(DllStructGetPtr($sAD_DTStruct)) $sTemp3 = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($sAD_Temp)) Return _Date_Time_SystemTimeToDateTimeStr($sTemp3, 1) EndIf EndIf ; Convert IADsLargeInteger parts to 100ns count $iLowPart = $_oADObject.LowPart $iHighPart = $_oADObject.HighPart If $iLowPart < 0 Then $iHighPart += 1; Compensate for IADsLargeInteger interface error $iDateParts= $iHighPart * 2 ^ 32 $iDateParts+= $iLowPart ; Check if user ever logged in If $iDateParts= 0 Then Return "n/a" Else ; Convert 100ns count to integer seconds $iSeconds = Floor($iDateParts/ 10000000) ; Convert seconds since 12:00AM January 01, 1601 to date string $sDateTime = _DateAdd("S", $iSeconds, "1601/01/01 00:00:00") ; Display result Return $sDateTime EndIf EndFunc
    1 point
×
×
  • Create New...