Jump to content

Make Sure String Is Not In String


Recommended Posts

Hello,

 

I am brain dead, and attempting to remedy a bug found in our software caused by recent updates.

The issue is simple:

  1. Parse data from clipboard to array (Working)
  2. Loop through the array and check if text is found (buggy?)
  3. Verify the text found does not contain a certain string (buggy?)
  4. Verify string found is above a certain length (buggy?)

Here is the comparison statement I have:

 

Func find($toFind, $notThis = '', $reqLength = -1)

    $found = 0
    $finder = 0
    If $notThis = '' And $reqLength = -1 Then
        While $found < 1 And $finder < UBound($splitClip)

            If StringInStr($splitClip[$finder], $toFind) Then
                $found = 1
;~              _ExtMsgBox(0, 4, "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder], 0, $Template_Generator, 0, False)
                MsgBox("", "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder])
                Return $finder
            EndIf
            $finder += 1

        WEnd
    ElseIf $notThis <> '' And $reqLength = -1 Then
        While $found < 1 And $finder < UBound($splitClip)

            If StringInStr($splitClip[$finder], $toFind) And (Not StringInStr($splitClip[$finder], $notThis)) Then
                $found = 1
;~              _ExtMsgBox(0, 4, "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder], 0, $Template_Generator, 0, False)
                MsgBox("", "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder])
                Return $finder
            EndIf
            $finder += 1

        WEnd
    Else
    ;THIS ONE IS NOT WORKING IT LOOPS PAST THE TEXT WANTED WHICH IS: Serial 22197956
        While $found < 1 And $finder < UBound($splitClip)

            ConsoleWrite("ArrayLen: " & UBound($splitClip) - 1 & " Index: " & $finder & " Found: " & $splitClip[$finder] & @CRLF)
            If StringInStr($splitClip[$finder], $toFind) And StringLen(StringInStr($splitClip[$finder], $toFind)) >= $reqLength And StringInStr($splitClip[$finder], $notThis) = 0 Then
                $found = 1
;~              _ExtMsgBox(0, 4, "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder], 0, $Template_Generator, 0, False)
                MsgBox("", "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder])
                Return $finder
            EndIf
            $finder += 1

        WEnd
    EndIf

;~              _ExtMsgBox(0, 4, "EMPTY", "NOTHING FOUND CAP'N, 'TWAS LOOKIN' FOR: " & $toFind, 0, $Template_Generator, 0, False)
    MsgBox("", "EMPTY", "NOTHING FOUND CAP'N, 'TWAS LOOKIN' FOR: " & $toFind)

    Return -1

EndFunc   ;==>find

The query I am inputting is as follows:

 

$retVal = find("Serial", "AdvCorr", 13)

 

I believe the issue lies in the part of the statement which is:

 

StringInStr($splitClip[$finder], $notThis) = 0

 

Here is an example of the Console Log:
 

;Anything below not commented is Output
ArrayLen: 329 Index: 0 Found: 329
ArrayLen: 329 Index: 1 Found: Field    Value    
ArrayLen: 329 Index: 2 Found:
ArrayLen: 329 Index: 3 Found: Summary    Warning Alert: REDACTED Role: Server Alarm type: Memory utilization Message: Memory utilization triggered over 90% at 91 %.    
ArrayLen: 329 Index: 4 Found:
ArrayLen: 329 Index: 5 Found: Node    REDACTED    
ArrayLen: 329 Index: 6 Found:
ArrayLen: 329 Index: 7 Found: Severity    Major    
ArrayLen: 329 Index: 8 Found:
ArrayLen: 329 Index: 9 Found: Acknowledged    Yes    
ArrayLen: 329 Index: 10 Found:
ArrayLen: 329 Index: 11 Found: LastOccurrence    4/15/21, 10:15 PM    
ArrayLen: 329 Index: 12 Found:
ArrayLen: 329 Index: 13 Found: Action        
ArrayLen: 329 Index: 14 Found:
ArrayLen: 329 Index: 15 Found: Address        
ArrayLen: 329 Index: 16 Found:
ArrayLen: 329 Index: 17 Found: AdvCorrCauseType    Unknown    
ArrayLen: 329 Index: 18 Found:
ArrayLen: 329 Index: 19 Found: AdvCorrServerName        
ArrayLen: 329 Index: 20 Found:
ArrayLen: 329 Index: 21 Found: AdvCorrServerSerial    0    
ArrayLen: 329 Index: 22 Found:
ArrayLen: 329 Index: 23 Found: Agent    REDACTED    
ArrayLen: 329 Index: 24 Found:
ArrayLen: 329 Index: 25 Found: AggregationFirst    4/15/21, 10:15 PM    
ArrayLen: 329 Index: 26 Found:
ArrayLen: 329 Index: 27 Found: AlertGroup    Memory utilization    
ArrayLen: 329 Index: 28 Found:
ArrayLen: 329 Index: 29 Found: AlertKey    REDACTED:REDACTED    
ArrayLen: 329 Index: 30 Found:
ArrayLen: 329 Index: 31 Found: BSM_Identity        
ArrayLen: 329 Index: 32 Found:
ArrayLen: 329 Index: 33 Found: CI_ADDomain        
ArrayLen: 329 Index: 34 Found:
ArrayLen: 329 Index: 35 Found: CI_AltContact        
ArrayLen: 329 Index: 36 Found:
ArrayLen: 329 Index: 37 Found: CI_App_Name        
ArrayLen: 329 Index: 38 Found:
ArrayLen: 329 Index: 39 Found: CI_App_Type        
ArrayLen: 329 Index: 40 Found:
ArrayLen: 329 Index: 41 Found: CI_ApplicationPlatform        
ArrayLen: 329 Index: 42 Found:
ArrayLen: 329 Index: 43 Found: CI_ApplicationTeam        
ArrayLen: 329 Index: 44 Found:
ArrayLen: 329 Index: 45 Found: CI_AssignmentGroup        
ArrayLen: 329 Index: 46 Found:
ArrayLen: 329 Index: 47 Found: CI_Assignment_Groups        
ArrayLen: 329 Index: 48 Found:
ArrayLen: 329 Index: 49 Found: CI_Back_Office        
ArrayLen: 329 Index: 50 Found:
ArrayLen: 329 Index: 51 Found: CI_Business_Criticality        
ArrayLen: 329 Index: 52 Found:
ArrayLen: 329 Index: 53 Found: CI_Business_Owner        
ArrayLen: 329 Index: 54 Found:
ArrayLen: 329 Index: 55 Found: CI_Business_Service        
ArrayLen: 329 Index: 56 Found:
ArrayLen: 329 Index: 57 Found: CI_Call_Center        
ArrayLen: 329 Index: 58 Found:
ArrayLen: 329 Index: 59 Found: CI_Category        
ArrayLen: 329 Index: 60 Found:
ArrayLen: 329 Index: 61 Found: CI_City        
ArrayLen: 329 Index: 62 Found:
ArrayLen: 329 Index: 63 Found: CI_Class        
ArrayLen: 329 Index: 64 Found:
ArrayLen: 329 Index: 65 Found: CI_Client_Facing        
ArrayLen: 329 Index: 66 Found:
ArrayLen: 329 Index: 67 Found: CI_Comments        
ArrayLen: 329 Index: 68 Found:
ArrayLen: 329 Index: 69 Found: CI_Contact        
ArrayLen: 329 Index: 70 Found:
ArrayLen: 329 Index: 71 Found: CI_ContactEmail        
ArrayLen: 329 Index: 72 Found:
ArrayLen: 329 Index: 73 Found: CI_ContactPhone        
ArrayLen: 329 Index: 74 Found:
ArrayLen: 329 Index: 75 Found: CI_Contains_PHI        
ArrayLen: 329 Index: 76 Found:
ArrayLen: 329 Index: 77 Found: CI_Contains_PII        
ArrayLen: 329 Index: 78 Found:
ArrayLen: 329 Index: 79 Found: CI_Core_App_Name        
ArrayLen: 329 Index: 80 Found:
ArrayLen: 329 Index: 81 Found: CI_DNS_Name        
ArrayLen: 329 Index: 82 Found:
ArrayLen: 329 Index: 83 Found: CI_DR_Data_Center        
ArrayLen: 329 Index: 84 Found:
ArrayLen: 329 Index: 85 Found: CI_DR_Plan        
ArrayLen: 329 Index: 86 Found:
ArrayLen: 329 Index: 87 Found: CI_DR_Plan_Reason        
ArrayLen: 329 Index: 88 Found:
ArrayLen: 329 Index: 89 Found: CI_Device_ID    0    
ArrayLen: 329 Index: 90 Found:
ArrayLen: 329 Index: 91 Found: CI_Enrichment_Status    Enriched    
ArrayLen: 329 Index: 92 Found:
ArrayLen: 329 Index: 93 Found: CI_GroupID        
ArrayLen: 329 Index: 94 Found:
ArrayLen: 329 Index: 95 Found: CI_HostedAPPs        
ArrayLen: 329 Index: 96 Found:
ArrayLen: 329 Index: 97 Found: CI_ID        
ArrayLen: 329 Index: 98 Found:
ArrayLen: 329 Index: 99 Found: CI_IPAddress    REDACTED    
ArrayLen: 329 Index: 100 Found:
ArrayLen: 329 Index: 101 Found: CI_Integrated_Core_Apps        
ArrayLen: 329 Index: 102 Found:
ArrayLen: 329 Index: 103 Found: CI_Is_Database        
ArrayLen: 329 Index: 104 Found:
ArrayLen: 329 Index: 105 Found: CI_Last_DR_Test_Date    0    
ArrayLen: 329 Index: 106 Found:
ArrayLen: 329 Index: 107 Found: CI_Model    Windows 2008 R2 Server    
ArrayLen: 329 Index: 108 Found:
ArrayLen: 329 Index: 109 Found: CI_OS_Support_Queue        
ArrayLen: 329 Index: 110 Found:
ArrayLen: 329 Index: 111 Found: CI_OperatingSystem        
ArrayLen: 329 Index: 112 Found:
ArrayLen: 329 Index: 113 Found: CI_Owner        
ArrayLen: 329 Index: 114 Found:
ArrayLen: 329 Index: 115 Found: CI_PDSI_Tower        
ArrayLen: 329 Index: 116 Found:
ArrayLen: 329 Index: 117 Found: CI_Primary_Data_Center        
ArrayLen: 329 Index: 118 Found:
ArrayLen: 329 Index: 119 Found: CI_RPO_hours        
ArrayLen: 329 Index: 120 Found:
ArrayLen: 329 Index: 121 Found: CI_RTO_hours        
ArrayLen: 329 Index: 122 Found:
ArrayLen: 329 Index: 123 Found: CI_SBU    undefined    
ArrayLen: 329 Index: 124 Found:
ArrayLen: 329 Index: 125 Found: CI_SSAE16_Scope        
ArrayLen: 329 Index: 126 Found:
ArrayLen: 329 Index: 127 Found: CI_Severtiy        
ArrayLen: 329 Index: 128 Found:
ArrayLen: 329 Index: 129 Found: CI_SharePoint_Link        
ArrayLen: 329 Index: 130 Found:
ArrayLen: 329 Index: 131 Found: CI_Source    REDACTED    
ArrayLen: 329 Index: 132 Found:
ArrayLen: 329 Index: 133 Found: CI_State        
ArrayLen: 329 Index: 134 Found:
ArrayLen: 329 Index: 135 Found: CI_Status        
ArrayLen: 329 Index: 136 Found:
ArrayLen: 329 Index: 137 Found: CI_SubSBU        
ArrayLen: 329 Index: 138 Found:
ArrayLen: 329 Index: 139 Found: CI_Tier_2_support_queue        
ArrayLen: 329 Index: 140 Found:
ArrayLen: 329 Index: 141 Found: CI_Tier_3_support_queue        
ArrayLen: 329 Index: 142 Found:
ArrayLen: 329 Index: 143 Found: CI_Zip        
ArrayLen: 329 Index: 144 Found:
ArrayLen: 329 Index: 145 Found: CauseType    Unknown    
ArrayLen: 329 Index: 146 Found:
ArrayLen: 329 Index: 147 Found: CauseWeight    0    
ArrayLen: 329 Index: 148 Found:
ArrayLen: 329 Index: 149 Found: Class    REDACTED    
ArrayLen: 329 Index: 150 Found:
ArrayLen: 329 Index: 151 Found: CloseCode        
ArrayLen: 329 Index: 152 Found:
ArrayLen: 329 Index: 153 Found: CloseNotes        
ArrayLen: 329 Index: 154 Found:
ArrayLen: 329 Index: 155 Found: CollectionFirst    0    
ArrayLen: 329 Index: 156 Found:
ArrayLen: 329 Index: 157 Found: CorrScore    0    
ArrayLen: 329 Index: 158 Found:
ArrayLen: 329 Index: 159 Found: CriticalClient    0    
ArrayLen: 329 Index: 160 Found:
ArrayLen: 329 Index: 161 Found: CustomText        
ArrayLen: 329 Index: 162 Found:
ArrayLen: 329 Index: 163 Found: Customer        
ArrayLen: 329 Index: 164 Found:
ArrayLen: 329 Index: 165 Found: DisplayFirst    0    
ArrayLen: 329 Index: 166 Found:
ArrayLen: 329 Index: 167 Found: Environment        
ArrayLen: 329 Index: 168 Found:
ArrayLen: 329 Index: 169 Found: EventId        
ArrayLen: 329 Index: 170 Found:
ArrayLen: 329 Index: 171 Found: ExpireTime    Not Set    
ArrayLen: 329 Index: 172 Found:
ArrayLen: 329 Index: 173 Found: ExtendedAttr        
ArrayLen: 329 Index: 174 Found:
ArrayLen: 329 Index: 175 Found: FirstOccurrence    4/15/21, 10:15 PM    
ArrayLen: 329 Index: 176 Found:
ArrayLen: 329 Index: 177 Found: Flash    No    
ArrayLen: 329 Index: 178 Found:
ArrayLen: 329 Index: 179 Found: Grade    0    
ArrayLen: 329 Index: 180 Found:
ArrayLen: 329 Index: 181 Found: IBMExtractedType        
ArrayLen: 329 Index: 182 Found:
ArrayLen: 329 Index: 183 Found: IBMProcessingStage    0    
ArrayLen: 329 Index: 184 Found:
ArrayLen: 329 Index: 185 Found: Identifier    REDACTED REDACTED:REDACTED Memory utilization REDACTED MTTrapd Probe on REDACTED Problem Server    
ArrayLen: 329 Index: 186 Found:
ArrayLen: 329 Index: 187 Found: ImpactWeight    0    
ArrayLen: 329 Index: 188 Found:
ArrayLen: 329 Index: 189 Found: InternalLast    4/15/21, 10:15 PM    
ArrayLen: 329 Index: 190 Found:
ArrayLen: 329 Index: 191 Found: JournalSent    0    
ArrayLen: 329 Index: 192 Found:
ArrayLen: 329 Index: 193 Found: LocalNodeAlias    REDACTED    
ArrayLen: 329 Index: 194 Found:
ArrayLen: 329 Index: 195 Found: LocalObjRelate    0    
ArrayLen: 329 Index: 196 Found:
ArrayLen: 329 Index: 197 Found: LocalPriObj        
ArrayLen: 329 Index: 198 Found:
ArrayLen: 329 Index: 199 Found: LocalRootObj        
ArrayLen: 329 Index: 200 Found:
ArrayLen: 329 Index: 201 Found: LocalSecObj        
ArrayLen: 329 Index: 202 Found:
ArrayLen: 329 Index: 203 Found: LocalTertObj        
ArrayLen: 329 Index: 204 Found:
ArrayLen: 329 Index: 205 Found: Location    undefined    
ArrayLen: 329 Index: 206 Found:
ArrayLen: 329 Index: 207 Found: Location_lat        
ArrayLen: 329 Index: 208 Found:
ArrayLen: 329 Index: 209 Found: Location_long        
ArrayLen: 329 Index: 210 Found:
ArrayLen: 329 Index: 211 Found: LogTicket    NoTicket    
ArrayLen: 329 Index: 212 Found:
ArrayLen: 329 Index: 213 Found: Manager    MTTrapd Probe on REDACTED    
ArrayLen: 329 Index: 214 Found:
ArrayLen: 329 Index: 215 Found: NmosCauseType    Unknown    
ArrayLen: 329 Index: 216 Found:
ArrayLen: 329 Index: 217 Found: NmosDomainName        
ArrayLen: 329 Index: 218 Found:
ArrayLen: 329 Index: 219 Found: NmosEntityId    0    
ArrayLen: 329 Index: 220 Found:
ArrayLen: 329 Index: 221 Found: NmosEventMap        
ArrayLen: 329 Index: 222 Found:
ArrayLen: 329 Index: 223 Found: NmosManagedStatus    Managed    
ArrayLen: 329 Index: 224 Found:
ArrayLen: 329 Index: 225 Found: NmosObjInst    0    
ArrayLen: 329 Index: 226 Found:
ArrayLen: 329 Index: 227 Found: NmosSerial        
ArrayLen: 329 Index: 228 Found:
ArrayLen: 329 Index: 229 Found: NodeAlias    REDACTED    
ArrayLen: 329 Index: 230 Found:
ArrayLen: 329 Index: 231 Found: NormalisedAlarmCode    0    
ArrayLen: 329 Index: 232 Found:
ArrayLen: 329 Index: 233 Found: NormalisedAlarmGroup        
ArrayLen: 329 Index: 234 Found:
ArrayLen: 329 Index: 235 Found: NormalisedAlarmName        
ArrayLen: 329 Index: 236 Found:
ArrayLen: 329 Index: 237 Found: OldRow    0    
ArrayLen: 329 Index: 238 Found:
ArrayLen: 329 Index: 239 Found: OwnerGID    Public    
ArrayLen: 329 Index: 240 Found:
ArrayLen: 329 Index: 241 Found: OwnerUID    REDACTED REDACTED    
ArrayLen: 329 Index: 242 Found:
ArrayLen: 329 Index: 243 Found: ParentIdentifier        
ArrayLen: 329 Index: 244 Found:
ArrayLen: 329 Index: 245 Found: ParentServerSerial    0    
ArrayLen: 329 Index: 246 Found:
ArrayLen: 329 Index: 247 Found: Parent_CI        
ArrayLen: 329 Index: 248 Found:
ArrayLen: 329 Index: 249 Found: PhysicalCard        
ArrayLen: 329 Index: 250 Found:
ArrayLen: 329 Index: 251 Found: PhysicalPort    0    
ArrayLen: 329 Index: 252 Found:
ArrayLen: 329 Index: 253 Found: PhysicalSlot    0    
ArrayLen: 329 Index: 254 Found:
ArrayLen: 329 Index: 255 Found: Poll    0    
ArrayLen: 329 Index: 256 Found:
ArrayLen: 329 Index: 257 Found: ProbeSubSecondId    0    
ArrayLen: 329 Index: 258 Found:
ArrayLen: 329 Index: 259 Found: ProcessReq    0    
ArrayLen: 329 Index: 260 Found:
ArrayLen: 329 Index: 261 Found: QuietPeriod    0    
ArrayLen: 329 Index: 262 Found:
ArrayLen: 329 Index: 263 Found: RE_Parent    unknown    
ArrayLen: 329 Index: 264 Found:
ArrayLen: 329 Index: 265 Found: RE_Resolve    0    
ArrayLen: 329 Index: 266 Found:
ArrayLen: 329 Index: 267 Found: RemoteNodeAlias        
ArrayLen: 329 Index: 268 Found:
ArrayLen: 329 Index: 269 Found: RemoteObjRelate    0    
ArrayLen: 329 Index: 270 Found:
ArrayLen: 329 Index: 271 Found: RemotePriObj        
ArrayLen: 329 Index: 272 Found:
ArrayLen: 329 Index: 273 Found: RemoteRootObj        
ArrayLen: 329 Index: 274 Found:
ArrayLen: 329 Index: 275 Found: RemoteSecObj        
ArrayLen: 329 Index: 276 Found:
ArrayLen: 329 Index: 277 Found: RemoteTertObj        
ArrayLen: 329 Index: 278 Found:
ArrayLen: 329 Index: 279 Found: ScopeID        
ArrayLen: 329 Index: 280 Found:
ArrayLen: 329 Index: 281 Found: Serial    22197956    ;I want this or the one below (they don't always both contain wanted data)
ArrayLen: 329 Index: 282 Found:
ArrayLen: 329 Index: 283 Found: ServerName    REDACTED_B    
ArrayLen: 329 Index: 284 Found:
ArrayLen: 329 Index: 285 Found: ServerSerial    22197956    ;I want this or the one above (they don't always both contain wanted data)
ArrayLen: 329 Index: 286 Found:
ArrayLen: 329 Index: 287 Found: Service    Server    
ArrayLen: 329 Index: 288 Found:
ArrayLen: 329 Index: 289 Found: ServiceNowErrorCode    0    
ArrayLen: 329 Index: 290 Found:
ArrayLen: 329 Index: 291 Found: ServiceNowState    0    
ArrayLen: 329 Index: 292 Found:
ArrayLen: 329 Index: 293 Found: ServiceNowSysId        
ArrayLen: 329 Index: 294 Found:
ArrayLen: 329 Index: 295 Found: ShortDescription    Memory utilization triggered over 90% at 91 %.    
ArrayLen: 329 Index: 296 Found:
ArrayLen: 329 Index: 297 Found: SiteName        
ArrayLen: 329 Index: 298 Found:
ArrayLen: 329 Index: 299 Found: SourceID    6    
ArrayLen: 329 Index: 300 Found:
ArrayLen: 329 Index: 301 Found: StateChange    4/15/21, 10:25 PM    
ArrayLen: 329 Index: 302 Found:
ArrayLen: 329 Index: 303 Found: SuppressEscl    Normal    
ArrayLen: 329 Index: 304 Found:
ArrayLen: 329 Index: 305 Found: TPCURL        
ArrayLen: 329 Index: 306 Found:
ArrayLen: 329 Index: 307 Found: TTCreatedBy        
ArrayLen: 329 Index: 308 Found:
ArrayLen: 329 Index: 309 Found: TTNumber        
ArrayLen: 329 Index: 310 Found:
ArrayLen: 329 Index: 311 Found: TTPriority    0    
ArrayLen: 329 Index: 312 Found:
ArrayLen: 329 Index: 313 Found: Tally    1    
ArrayLen: 329 Index: 314 Found:
ArrayLen: 329 Index: 315 Found: TaskList    Not in Task List    
ArrayLen: 329 Index: 316 Found:
ArrayLen: 329 Index: 317 Found: Technology    Server    
ArrayLen: 329 Index: 318 Found:
ArrayLen: 329 Index: 319 Found: Type    Problem    
ArrayLen: 329 Index: 320 Found:
ArrayLen: 329 Index: 321 Found: URL        
ArrayLen: 329 Index: 322 Found:
ArrayLen: 329 Index: 323 Found: X733CorrNotif        
ArrayLen: 329 Index: 324 Found:
ArrayLen: 329 Index: 325 Found: X733EventType    Not Defined    
ArrayLen: 329 Index: 326 Found:
ArrayLen: 329 Index: 327 Found: X733ProbableCause    Not Defined    
ArrayLen: 329 Index: 328 Found:
ArrayLen: 329 Index: 329 Found: X733SpecificProb


;Anything above not commented is Output

Edited by Jos
added codebox round output
Link to comment
Share on other sites

Just now, JockoDundee said:

You haven’t said what the problem is.

Which input causes an incorrect output?

We don’t need data that is working, just a single function call that doesn’t work.

 

I gave the input, as previously commented, I gave the query which is failing, and commented the data I am looking for it to find on the input data, I gave the function call that doesn't work as well. I will lay it out for you again:

Failing Func Call:

 

$retVal = find("Serial", "AdvCorr", 13)

Function Code:
 

Func find($toFind, $notThis = '', $reqLength = -1)

    $found = 0
    $finder = 0
    If $notThis = '' And $reqLength = -1 Then
        While $found < 1 And $finder < UBound($splitClip)

            If StringInStr($splitClip[$finder], $toFind) Then
                $found = 1
;~              _ExtMsgBox(0, 4, "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder], 0, $Template_Generator, 0, False)
                MsgBox("", "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder])
                Return $finder
            EndIf
            $finder += 1

        WEnd
    ElseIf $notThis <> '' And $reqLength = -1 Then
        While $found < 1 And $finder < UBound($splitClip)

            If StringInStr($splitClip[$finder], $toFind) And (Not StringInStr($splitClip[$finder], $notThis)) Then
                $found = 1
;~              _ExtMsgBox(0, 4, "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder], 0, $Template_Generator, 0, False)
                MsgBox("", "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder])
                Return $finder
            EndIf
            $finder += 1

        WEnd
    Else
    ;THIS ONE IS NOT WORKING IT LOOPS PAST THE TEXT WANTED WHICH IS: Serial 22197956
        While $found < 1 And $finder < UBound($splitClip)

            ConsoleWrite("ArrayLen: " & UBound($splitClip) - 1 & " Index: " & $finder & " Found: " & $splitClip[$finder] & @CRLF)
            If StringInStr($splitClip[$finder], $toFind) And StringLen(StringInStr($splitClip[$finder], $toFind)) >= $reqLength And StringInStr($splitClip[$finder], $notThis) = 0 Then
                $found = 1
;~              _ExtMsgBox(0, 4, "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder], 0, $Template_Generator, 0, False)
                MsgBox("", "FOUND", "FOUND THIS CAP'N: " & $splitClip[$finder])
                Return $finder
            EndIf
            $finder += 1

        WEnd
    EndIf

;~              _ExtMsgBox(0, 4, "EMPTY", "NOTHING FOUND CAP'N, 'TWAS LOOKIN' FOR: " & $toFind, 0, $Template_Generator, 0, False)
    MsgBox("", "EMPTY", "NOTHING FOUND CAP'N, 'TWAS LOOKIN' FOR: " & $toFind)

    Return -1

EndFunc   ;==>find


Desired Output: Position In Array Of "Serial    22197956" or " ServerSerial    22197956"

Input Data:

Field    Value    
Summary    Warning Alert: REDACTED Role: Server Alarm type: Memory utilization Message: Memory utilization triggered over 90% at 91 %.    
Node    REDACTED    
Severity    Major    
Acknowledged    Yes    
LastOccurrence    4/15/21, 10:15 PM    
Action        
Address        
AdvCorrCauseType    Unknown    
AdvCorrServerName        
AdvCorrServerSerial    0    
Agent    REDACTED    
AggregationFirst    4/15/21, 10:15 PM    
AlertGroup    Memory utilization    
AlertKey    REDACTED:REDACTED    
BSM_Identity        
CI_ADDomain        
CI_AltContact        
CI_App_Name        
CI_App_Type        
CI_ApplicationPlatform        
CI_ApplicationTeam        
CI_AssignmentGroup        
CI_Assignment_Groups        
CI_Back_Office        
CI_Business_Criticality        
CI_Business_Owner        
CI_Business_Service        
CI_Call_Center        
CI_Category        
CI_City        
CI_Class        
CI_Client_Facing        
CI_Comments        
CI_Contact        
CI_ContactEmail        
CI_ContactPhone        
CI_Contains_PHI        
CI_Contains_PII        
CI_Core_App_Name        
CI_DNS_Name        
CI_DR_Data_Center        
CI_DR_Plan        
CI_DR_Plan_Reason        
CI_Device_ID    0    
CI_Enrichment_Status    Enriched    
CI_GroupID        
CI_HostedAPPs        
CI_ID        
CI_IPAddress    REDACTED    
CI_Integrated_Core_Apps        
CI_Is_Database        
CI_Last_DR_Test_Date    0    
CI_Model    Windows 2008 R2 Server    
CI_OS_Support_Queue        
CI_OperatingSystem        
CI_Owner        
CI_PDSI_Tower        
CI_Primary_Data_Center        
CI_RPO_hours        
CI_RTO_hours        
CI_SBU    undefined    
CI_SSAE16_Scope        
CI_Severtiy        
CI_SharePoint_Link        
CI_Source    REDACTED    
CI_State        
CI_Status        
CI_SubSBU        
CI_Tier_2_support_queue        
CI_Tier_3_support_queue        
CI_Zip        
CauseType    Unknown    
CauseWeight    0    
Class    Solarwinds    
CloseCode        
CloseNotes        
CollectionFirst    0    
CorrScore    0    
CriticalClient    0    
CustomText        
Customer        
DisplayFirst    0    
Environment        
EventId        
ExpireTime    Not Set    
ExtendedAttr        
FirstOccurrence    4/15/21, 10:15 PM    
Flash    No    
Grade    0    
IBMExtractedType        
IBMProcessingStage    0    
Identifier    REDACTED REDACTED:REDACTED Memory utilization REDACTED MTTrapd Probe on REDACTED Problem Server    
ImpactWeight    0    
InternalLast    4/15/21, 10:15 PM    
JournalSent    0    
LocalNodeAlias    REDACTED    
LocalObjRelate    0    
LocalPriObj        
LocalRootObj        
LocalSecObj        
LocalTertObj        
Location    undefined    
Location_lat        
Location_long        
LogTicket    NoTicket    
Manager    MTTrapd Probe on REDACTED    
NmosCauseType    Unknown    
NmosDomainName        
NmosEntityId    0    
NmosEventMap        
NmosManagedStatus    Managed    
NmosObjInst    0    
NmosSerial        
NodeAlias    REDACTED    
NormalisedAlarmCode    0    
NormalisedAlarmGroup        
NormalisedAlarmName        
OldRow    0    
OwnerGID    Public    
OwnerUID    REDACTED REDACTED    
ParentIdentifier        
ParentServerSerial    0    
Parent_CI        
PhysicalCard        
PhysicalPort    0    
PhysicalSlot    0    
Poll    0    
ProbeSubSecondId    0    
ProcessReq    0    
QuietPeriod    0    
RE_Parent    unknown    
RE_Resolve    0    
RemoteNodeAlias        
RemoteObjRelate    0    
RemotePriObj        
RemoteRootObj        
RemoteSecObj        
RemoteTertObj        
ScopeID        
Serial    22197956    
ServerName    CONDUENT_B    
ServerSerial    22197956    
Service    Server    
ServiceNowErrorCode    0    
ServiceNowState    0    
ServiceNowSysId        
ShortDescription    Memory utilization triggered over 90% at 91 %.    
SiteName        
SourceID    6    
StateChange    4/15/21, 10:25 PM    
SuppressEscl    Normal    
TPCURL        
TTCreatedBy        
TTNumber        
TTPriority    0    
Tally    1    
TaskList    Not in Task List    
Technology    Server    
Type    Problem    
URL        
X733CorrNotif        
X733EventType    Not Defined    
X733ProbableCause    Not Defined    
X733SpecificProb

Link to comment
Share on other sites

10 minutes ago, rm4453 said:

Desired Output: Position In Array Of "Serial    22197956" or " ServerSerial    22197956"

Then this should be enough for what you're looking for:

#include <Array.au3>
#include <File.au3>

Test()


Func Test()

    Local $strFileName = @ScriptDir & "\TestFile.txt", _
          $arrFileContent, _
          $strSerial, _
          $arrSerials[0]

    $arrFileContent = FileReadToArray($strFileName)
    If @error Then Return ConsoleWrite("FileReadToArray ERR: " & @error & @CRLF)

    For $i = 0 To UBound($arrFileContent) - 1 Step 1
        If StringRegExp($arrFileContent[$i], '(?m)^(?:Server)?Serial\s*(\d+)', $STR_REGEXPMATCH) Then
            $strSerial = StringRegExp($arrFileContent[$i], '(?m)^(?:Server)?Serial\s*(\d+)', $STR_REGEXPARRAYMATCH)[0]
            _ArrayAdd($arrSerials, "Position in the array: " & $i & " - Value: " & $strSerial)
        EndIf
    Next

    If IsArray($arrSerials) Then _ArrayDisplay($arrSerials)

EndFunc

TestFile.txt:

Spoiler

329
Field    Value    
Summary    Warning Alert: REDACTED Role: Server Alarm type: Memory utilization Message: Memory utilization triggered over 90% at 91 %.    
Node    REDACTED    
Severity    Major    
Acknowledged    Yes    
LastOccurrence    4/15/21, 10:15 PM    
Action        
Address        
AdvCorrCauseType    Unknown    
AdvCorrServerName        
AdvCorrServerSerial    0    
Agent    REDACTED    
AggregationFirst    4/15/21, 10:15 PM    
AlertGroup    Memory utilization    
AlertKey    REDACTED:REDACTED    
BSM_Identity        
CI_ADDomain        
CI_AltContact        
CI_App_Name        
CI_App_Type        
CI_ApplicationPlatform        
CI_ApplicationTeam        
CI_AssignmentGroup        
CI_Assignment_Groups        
CI_Back_Office        
CI_Business_Criticality        
CI_Business_Owner        
CI_Business_Service        
CI_Call_Center        
CI_Category        
CI_City        
CI_Class        
CI_Client_Facing        
CI_Comments        
CI_Contact        
CI_ContactEmail        
CI_ContactPhone        
CI_Contains_PHI        
CI_Contains_PII        
CI_Core_App_Name        
CI_DNS_Name        
CI_DR_Data_Center        
CI_DR_Plan        
CI_DR_Plan_Reason        
CI_Device_ID    0    
CI_Enrichment_Status    Enriched    
CI_GroupID        
CI_HostedAPPs        
CI_ID        
CI_IPAddress    REDACTED    
CI_Integrated_Core_Apps        
CI_Is_Database        
CI_Last_DR_Test_Date    0    
CI_Model    Windows 2008 R2 Server    
CI_OS_Support_Queue        
CI_OperatingSystem        
CI_Owner        
CI_PDSI_Tower        
CI_Primary_Data_Center        
CI_RPO_hours        
CI_RTO_hours        
CI_SBU    undefined    
CI_SSAE16_Scope        
CI_Severtiy        
CI_SharePoint_Link        
CI_Source    REDACTED    
CI_State        
CI_Status        
CI_SubSBU        
CI_Tier_2_support_queue        
CI_Tier_3_support_queue        
CI_Zip        
CauseType    Unknown    
CauseWeight    0    
Class    REDACTED    
CloseCode        
CloseNotes        
CollectionFirst    0    
CorrScore    0    
CriticalClient    0    
CustomText        
Customer        
DisplayFirst    0    
Environment        
EventId        
ExpireTime    Not Set    
ExtendedAttr        
FirstOccurrence    4/15/21, 10:15 PM    
Flash    No    
Grade    0    
IBMExtractedType        
IBMProcessingStage    0    
Identifier    REDACTED REDACTED:REDACTED Memory utilization REDACTED MTTrapd Probe on REDACTED Problem Server    
ImpactWeight    0    
InternalLast    4/15/21, 10:15 PM    
JournalSent    0    
LocalNodeAlias    REDACTED    
LocalObjRelate    0    
LocalPriObj        
LocalRootObj        
LocalSecObj        
LocalTertObj        
Location    undefined    
Location_lat        
Location_long        
LogTicket    NoTicket    
Manager    MTTrapd Probe on REDACTED    
NmosCauseType    Unknown    
NmosDomainName        
NmosEntityId    0    
NmosEventMap        
NmosManagedStatus    Managed    
NmosObjInst    0    
NmosSerial        
NodeAlias    REDACTED    
NormalisedAlarmCode    0    
NormalisedAlarmGroup        
NormalisedAlarmName        
OldRow    0    
OwnerGID    Public    
OwnerUID    REDACTED REDACTED    
ParentIdentifier        
ParentServerSerial    0    
Parent_CI        
PhysicalCard        
PhysicalPort    0    
PhysicalSlot    0    
Poll    0    
ProbeSubSecondId    0    
ProcessReq    0    
QuietPeriod    0    
RE_Parent    unknown    
RE_Resolve    0    
RemoteNodeAlias        
RemoteObjRelate    0    
RemotePriObj        
RemoteRootObj        
RemoteSecObj        
RemoteTertObj        
ScopeID        
Serial    22197956    ;I want this or the one below (they don't always both contain wanted data)
ServerName    REDACTED_B    
ServerSerial    22197956    ;I want this or the one above (they don't always both contain wanted data)
Service    Server    
ServiceNowErrorCode    0    
ServiceNowState    0    
ServiceNowSysId        
ShortDescription    Memory utilization triggered over 90% at 91 %.    
SiteName        
SourceID    6    
StateChange    4/15/21, 10:25 PM    
SuppressEscl    Normal    
TPCURL        
TTCreatedBy        
TTNumber        
TTPriority    0    
Tally    1    
TaskList    Not in Task List    
Technology    Server    
Type    Problem    
URL        
X733CorrNotif        
X733EventType    Not Defined    
X733ProbableCause    Not Defined    
X733SpecificProb
;Anything above not commented is Output

 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

1 minute ago, FrancescoDiMuro said:

Then this should be enough for what you're looking for:

#include <Array.au3>
#include <File.au3>

Test()


Func Test()

    Local $strFileName = @ScriptDir & "\TestFile.txt", _
          $strFileContent, _
          $arrSerials

    $strFileContent = FileRead($strFileName)
    If @error Then Return ConsoleWrite("FileReadToArray ERR: " & @error & @CRLF)

    $arrSerials = StringRegExp($strFileContent, '(?m)^(?:Server)?Serial\s*(\d+)', $STR_REGEXPARRAYGLOBALMATCH)
    If IsArray($arrSerials) Then _ArrayDisplay($arrSerials)

EndFunc

TestFile.txt:

  Reveal hidden contents

329
Field    Value    
Summary    Warning Alert: REDACTED Role: Server Alarm type: Memory utilization Message: Memory utilization triggered over 90% at 91 %.    
Node    REDACTED    
Severity    Major    
Acknowledged    Yes    
LastOccurrence    4/15/21, 10:15 PM    
Action        
Address        
AdvCorrCauseType    Unknown    
AdvCorrServerName        
AdvCorrServerSerial    0    
Agent    REDACTED    
AggregationFirst    4/15/21, 10:15 PM    
AlertGroup    Memory utilization    
AlertKey    REDACTED:REDACTED    
BSM_Identity        
CI_ADDomain        
CI_AltContact        
CI_App_Name        
CI_App_Type        
CI_ApplicationPlatform        
CI_ApplicationTeam        
CI_AssignmentGroup        
CI_Assignment_Groups        
CI_Back_Office        
CI_Business_Criticality        
CI_Business_Owner        
CI_Business_Service        
CI_Call_Center        
CI_Category        
CI_City        
CI_Class        
CI_Client_Facing        
CI_Comments        
CI_Contact        
CI_ContactEmail        
CI_ContactPhone        
CI_Contains_PHI        
CI_Contains_PII        
CI_Core_App_Name        
CI_DNS_Name        
CI_DR_Data_Center        
CI_DR_Plan        
CI_DR_Plan_Reason        
CI_Device_ID    0    
CI_Enrichment_Status    Enriched    
CI_GroupID        
CI_HostedAPPs        
CI_ID        
CI_IPAddress    REDACTED    
CI_Integrated_Core_Apps        
CI_Is_Database        
CI_Last_DR_Test_Date    0    
CI_Model    Windows 2008 R2 Server    
CI_OS_Support_Queue        
CI_OperatingSystem        
CI_Owner        
CI_PDSI_Tower        
CI_Primary_Data_Center        
CI_RPO_hours        
CI_RTO_hours        
CI_SBU    undefined    
CI_SSAE16_Scope        
CI_Severtiy        
CI_SharePoint_Link        
CI_Source    REDACTED    
CI_State        
CI_Status        
CI_SubSBU        
CI_Tier_2_support_queue        
CI_Tier_3_support_queue        
CI_Zip        
CauseType    Unknown    
CauseWeight    0    
Class    REDACTED    
CloseCode        
CloseNotes        
CollectionFirst    0    
CorrScore    0    
CriticalClient    0    
CustomText        
Customer        
DisplayFirst    0    
Environment        
EventId        
ExpireTime    Not Set    
ExtendedAttr        
FirstOccurrence    4/15/21, 10:15 PM    
Flash    No    
Grade    0    
IBMExtractedType        
IBMProcessingStage    0    
Identifier    REDACTED REDACTED:REDACTED Memory utilization REDACTED MTTrapd Probe on REDACTED Problem Server    
ImpactWeight    0    
InternalLast    4/15/21, 10:15 PM    
JournalSent    0    
LocalNodeAlias    REDACTED    
LocalObjRelate    0    
LocalPriObj        
LocalRootObj        
LocalSecObj        
LocalTertObj        
Location    undefined    
Location_lat        
Location_long        
LogTicket    NoTicket    
Manager    MTTrapd Probe on REDACTED    
NmosCauseType    Unknown    
NmosDomainName        
NmosEntityId    0    
NmosEventMap        
NmosManagedStatus    Managed    
NmosObjInst    0    
NmosSerial        
NodeAlias    REDACTED    
NormalisedAlarmCode    0    
NormalisedAlarmGroup        
NormalisedAlarmName        
OldRow    0    
OwnerGID    Public    
OwnerUID    REDACTED REDACTED    
ParentIdentifier        
ParentServerSerial    0    
Parent_CI        
PhysicalCard        
PhysicalPort    0    
PhysicalSlot    0    
Poll    0    
ProbeSubSecondId    0    
ProcessReq    0    
QuietPeriod    0    
RE_Parent    unknown    
RE_Resolve    0    
RemoteNodeAlias        
RemoteObjRelate    0    
RemotePriObj        
RemoteRootObj        
RemoteSecObj        
RemoteTertObj        
ScopeID        
Serial    22197956    ;I want this or the one below (they don't always both contain wanted data)
ServerName    REDACTED_B    
ServerSerial    22197956    ;I want this or the one above (they don't always both contain wanted data)
Service    Server    
ServiceNowErrorCode    0    
ServiceNowState    0    
ServiceNowSysId        
ShortDescription    Memory utilization triggered over 90% at 91 %.    
SiteName        
SourceID    6    
StateChange    4/15/21, 10:25 PM    
SuppressEscl    Normal    
TPCURL        
TTCreatedBy        
TTNumber        
TTPriority    0    
Tally    1    
TaskList    Not in Task List    
Technology    Server    
Type    Problem    
URL        
X733CorrNotif        
X733EventType    Not Defined    
X733ProbableCause    Not Defined    
X733SpecificProb
;Anything above not commented is Output

 

It is reading from user clipboard not text file, and needs the already set requirements, due to the function being used to filter more than just these vars...

However I will attempt to adapt what you have suggested in the mean time.

Link to comment
Share on other sites

@rm4453
I edited the post above, so please take a look at it.

5 minutes ago, rm4453 said:

It is reading from user clipboard not text file

Quite easy to adapt it, isn't it?

5 minutes ago, rm4453 said:

and needs the already set requirements

That's just a filter and a lenght of a serial number, which, in your case would never be found since it is set to 13 while the actual lenght of the serial number you want to find is 8 characters long, so, maybe you need to be clearer?
Define what you have and tell us exactly what you need :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

5 minutes ago, FrancescoDiMuro said:

@rm4453
I edited the post above, so please take a look at it.

Quite easy to adapt it, isn't it?

That's just a filter and a lenght of a serial number, which, in your case would never be found since it is set to 13 while the actual lenght of the serial number you want to find is 8 characters long, so, maybe you need to be clearer?
Define what you have and tell us exactly what you need :)

I have attempted lowering the length to 1 less than the serial numbers length, however that did not change anything.

The issue I am having with adapting yours is not knowing regex, as I use this same function to parse for most of what is in the input from separate queries.

Thus modifying it too much will cause major issues, and require a big rewrite.
I believe the real issue with what I posted code wise, as previously mentioned is trying to verify a certain string is not in the string found.

I say this as I was able to get it to parse when I did not include that, however it would parse at first found result, which would be array line: AdvCorrServerSerial 0

Which is not the output I need, which is why I added in the verification that the string is not found.

Link to comment
Share on other sites

@rm4453
When you need to set various filters on a data set, then you need to use the proper tools.
In this case, StringInStr() needs to be very specific, since it is a good tool, but not the best for what you need.

Then, as I told you above, if you don't define what you have and tell us what you want, we can't assist you.

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

Maybe this (will return all occurrences) ?

#include <Array.au3>

Local $aClip = FileReadToArray("Test.txt") ; reading a file instead of clipboard

$retVal = find($aClip, "Serial", "AdvCorr", 13)
_ArrayDisplay($retVal)

Func find(ByRef $aArray, $toFind, $notThis = '', $reqLength = -1)
  Local $finder
  For $i = 0 to UBound($aArray) - 1
    If StringRegExp($aArray[$i], $toFind) Then
      If Not $notThis Or Not StringRegExp($aArray[$i], $notThis) Then
        If StringLen(StringStripWS($aArray[$i], $STR_STRIPTRAILING)) >= $reqLength Then
          $finder &= $i & "|"
          ConsoleWrite ($aArray[$i] & @CRLF)
        EndIf
      EndIf
    EndIf
  Next
  If Not $finder Then Return Null
  Return StringSplit(StringTrimRight($finder, 1), "|", $STR_NOCOUNT)
EndFunc
Quote

+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
ParentServerSerial    0    
Serial    22197956    
ServerSerial    22197956    
+>07:48:16 AutoIt3.exe ended.rc:0

image.png.a13608c237cc5b24869b970a9aeeb580.png

Edited by Nine
corrected a small bug
Link to comment
Share on other sites

Quote

If StringInStr($splitClip[$finder], $toFind) And StringLen(StringInStr($splitClip[$finder], $toFind)) >= $reqLength And StringInStr($splitClip[$finder], $notThis) = 0 Then

@rm4453

I'm looking at the part above StringLen(StringInStr($splitClip[$finder], $toFind)) >= $reqLength

Isn't this code asking for the length of the number of digits (StringLen) in the result of the StringInStr?  Isn't the StringInStr result likely to be a one or two digit number and always less than the $reqLength of 13 ?

 

Link to comment
Share on other sites

4 hours ago, wolflake said:

Isn't this code asking for the length of the number of digits (StringLen) in the result of the StringInStr?

The result of StringInStr is the position where string is found or if not found -1.

The position in string is between 0 (found at begin) and maxlength - length of substring (found at the end).

Using the length of founded string for checking is only another test for correct result but do not beware of failure results.

So i suggest:

  • use the script @Nine postet and find a way to elimate the not wantet results.
  • or find a better logic using the func's _ArrayFindAll and StringMid.

my test to solve:

#include <Array.au3>

Global $aSplitClip = FileReadToArray('output,txt.txt')
;_ArrayDisplay($aSplitClip)
$retVal = check($aSplitClip, "Serial", "NmosSerial", 12)
MsgBox(0, 'Test', $retVal)

Func check($aData, $toFind, $notThis = '', $reqLength = -1)
    ConsoleWrite('Find: ' & @TAB & $toFind & @TAB & $notThis & @TAB & $reqLength & @CRLF)
    _ArrayInsert($aData, 0, 'not fond')
    $aFound = _ArrayFindAll($aData, $toFind, 0, 0, 0, 1)
    _ArrayDisplay($aFound)
    ;$aNotThis  = _ArrayFindAll($aData, $notThis, 0, 0, 0, 1)
    ;_ArrayDisplay($aNotThis)
    $iResult = 0
    For $iFound = 0 To UBound($aFound) - 1
        ;$iStart = 0
        ;$iEnd = 0
        ;$iLen = 0
        $iStart = StringInStr($aData[$aFound[$iFound]], $toFind)
        $iEnd = StringInStr($aData[$aFound[$iFound] & ' '], ' ', 0, 1, $iStart)
        $iStart = StringInStr($aData[$aFound[$iFound]], ' ', 0, -1, $iEnd - 1) + 1
        $iLen = $iEnd - $iStart
        $sfound = StringMid($aData[$aFound[$iFound]], $iStart, $iLen)
        If ($iLen = $reqLength) And Not StringInStr($aData[$aFound[$iFound]], $notThis) Then
            $iResult = $iFound
            ConsoleWrite('newest match: ' & $sfound & @TAB & $iStart & @TAB & $iEnd & @TAB & $iLen & @CRLF)
        EndIf
    Next
    ;ConsoleWrite($iResult & @CRLF)
    Switch IsArray($aFound)
        Case 0
            Return $aData[0]
        Case Else
            Return $aData[$aFound[$iResult]]
    EndSwitch

EndFunc   ;==>check

 

Link to comment
Share on other sites

@AutoBert 

When "Serial" is the $tofind and "ServerSerial    22197956" is the element of the array being looked at and I use the expression:

ConsoleWrite(StringLen(StringInStr("ServerSerial    22197956", "Serial")) & @CRLF)

I get 1.  Not because it's in the first position but because it's only on digit long.

ConsoleWrite(StringLen(StringInStr("ServerSerial    22197956", "22197956")) & @CRLF)

Gives me 2 event though the position in the string is 17.

So expecting the comparison of this expression to a $reqLength of 13 will never be TRUE.

Do you agree?

BTW I have no problem with using @Nine 's solution I was just looking at the logic of @rm4453 's code.

Link to comment
Share on other sites

9 hours ago, wolflake said:

So expecting the comparison of this expression to a $reqLength of 13 will never be TRUE.

Do you agree?

Yes.

9 hours ago, wolflake said:

BTW I have no problem with using @Nine 's solution

That's fine.

 

9 hours ago, wolflake said:

I was just looking at the logic of @rm4453 's code

Sorry, regex is not a skill of mine. BUT for your needs the best tool. Specialy if you need a fast solution.

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...