Arrayfind possible with wildcards?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Uwe Berlin
Newbie
Posts: 2
Joined: Wed May 08, 2019 2:22 pm

Arrayfind possible with wildcards?

Post by Uwe Berlin » Mon Oct 09, 2023 5:36 pm

Hi together,

I get via OCR a string and seperate this. The result of thes was found in a array of course.
Now I need the array index, in which my search term is part of the string.
Example:
Dim>arExample,5
let>arrExample_1=/hck23
let>arrExample_2= good_KBS_perfekt
let>arrExample_3=Book17 Page5
let>arrExample_4=Greetings to you

ArrayFind,arrExample,*KBS*,nIndex,,_n doesn´t work

I need the index of the array field with the content "KBS".The position of "KBS" in the field was not fixed!
To realize this with nested loops seems to me possible, but not elegant.
Does anyone have another solution for this?
Thank you very much and best regards
Uwe

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1354
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Arrayfind possible with wildcards?

Post by Dorian (MJT support) » Mon Oct 09, 2023 11:37 pm

Firstly you have some errors in there. "Dim" should be "ArrayDim" and "ArrayFind," should be "ArrayFind>"

Once those are sorted - as per the manual - you can use Regex

Code: Select all

Let>use_regex=1
ArrayDim>arExample,5
let>arrExample_1=/hck23
let>arrExample_2= good_KBS_perfekt
let>arrExample_3=Book17 Page5
let>arrExample_4=Greetings to you

ArrayFind>arrExample,KBS.*?,nIndex2,1
Yes, we have a Custom Scripting Service. Message me or go here

Uwe Berlin
Newbie
Posts: 2
Joined: Wed May 08, 2019 2:22 pm

Re: Arrayfind possible with wildcards?

Post by Uwe Berlin » Tue Oct 10, 2023 8:37 am

Hi Dorian, thank you for the proposed solution.

Sorry for my typos in the example, I typed, no copy paste :roll: . You are right of course! :)

Your lines of code work perfectly, thanks!
I need to learn more about REGEX, because I didn't understand that part yet.

By this way, I would be happy in general if the code examples in the help function would increase ;-)

Many greetings and thanks again
Uwe

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts