How to search for strings in variable positions

Hi to all,
I am dealing with a use case that requires the identification of an element on an excel sheet, and the search for the same on another excel sheet.

I have complications, as the position is variable.

The trigger file contains a cell with this type of daa:

_Number fidejussione : 01383-8200-00737432 _Date fid : 20180926

The item I need to take is the highlighted number: 00737432.

I need to figure out if it is present in another excel sheet that contains a string with another format:
03000/01000/8200/00737432/3015/2018 000000505050

To complicate the work, it must be considered that this data, in this second file, is not always in the same position.
In the example above, the number 00737432 is after the third /, but in other rows of the excel sheet the number is after the second.

I would need help both to collect the data and to search for it.
On the source file, I know that this data is related to the surety number, and is found in the string:
_Number fidejussione : 01383-8200- 00737432 _Date fid : 20180926
and before the “_date”

I don’t know how to search for this element, in a string with a variable position.
03000/01000/8200/00737432/3015/2018 000000505050

Can anyone help me with this?

Hi @AaronMark,

I’m not entirely sure if I understood your question correctly but if you can get the String from file1 that you need to search from file2, you just need to use Regular Expressions in order to test a String against it regardless of it’s position.

The steps would probably be something like this:

  1. Get String from file1 that you need to use to search in file2

  2. While going thru (iterating) values in file2, you can use “Is Match” activity to test each string if it maches what you’re looking for.


Hope that helps.

Disclaimer: Screenshot might not be exactly what you need. But just to give you an idea.

Alternative solution if regular expressions are not your thing…

say your (2nd) ‘source’ is 123/345/678/3173/633265
And the values can be in different positions as you mention.

Use this statement: Assign: myValues = source.split("/"c)
With myValues as an array(of String)

The split will separate the values in the array based on the / character.

Next you can iterate through the array with a ‘for each’ item in myValues, where you can evaluate each item until you find your key value.

1 Like

Yeah with the same approach as suggested by @Jeroen_van_Loon, just after splitting the string with ‘/’ and added to the array, just use the resultArray.Contains(“YourString”).

Ok … I take some time to understand the instructions and do some tests.
I’m not very experienced in programming.
I get along with simple automation projects, but when I have to use manipulated strings, I’m weak.

To get a general picture of the work, it is a question of verifying whether the payments notified by the bank are correct.
The bank provides me with an xlsx or csv with one format,
but the comparison table has conditions written in a different format.

Thanks… to all…