Capture the value next to each CoCode text

Input Text :

Queretaro - Plant 0260/0265 - CoCode 3106, Plant 0310 - CoCode HF, Plant 0330 - CoCode HUK

Requirement 1 –

We need to capture the each text (highlighted in Bold) available next to each “CoCode” text ( It can be 4 digits or 3 or 2 letters)

Expected Values : 3106 , HF & HUK

Requirement 2 –
Validate each captured values
in the DT and if any one of the captured text is available in the DT ( Attached the DT values in the excel
DBForValidation.xlsx (10.3 KB)
)… Then store str_RegionMatching=“Yes” … if none of the captured values is not matching with DT with Then store str_RegionMatching=“No”

1 Like

@Sathish_Kumar_S

(?<=CoCode )[a-zA-z\d]+

Use this expression gives output as array

System.Text.RegularExpressions.Regex.Matches(strinput, "(?<=CoCode )[a-zA-z\d]+").Cast(of Match).Select(Function(a) a.ToString).toarray

for smaller founds we can use a Collection Contains
IF: myCodesAsStringArray.Contains(myRowColString)
For more large sets we can use a HashSet for the Codes and the Contains method

UPD1 - vice-versa check

dt.AsEnumerable.Select(Function (x) x("ColNameOrIndex").toString.Trim).Intersect(myCodesAsStringArray).Any()
1 Like

Thank you… Now have all 3 values in StrArray varaible. How do i search values available in array variable to DT ?

if any one of the value available is matching with DT then str_RegionMatching=“Yes”

if none of the captured values is not matching with DT with Then store str_RegionMatching=“No”

1 Like

@Sathish_Kumar_S

arrayfinding.zip (3.5 KB)

Can you check this workflow if you face any issue let me know

Thanks a lot … it works like a charm!..

1 Like

@Sathish_Kumar_S

Happy automation

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.