While working on a windows legacy project in studio, I got the compiler error thrown from working with Regex:
The assign where the error was thrown:
The error:
the regex: System.Text.RegularExpressions.Regex.Match(currentMatch.ToString,β(([0-9]+[A-Z]+)|([A-Z]+[0-9]+)|([0-9]+))β).Value
I checked my import and I do have the System.Text.RegularExpression
in my namespace.
I have applied the solution I found on the UiPath forum for similar issue, but It did not work.
Help will be appreciated.
@Yomi_Oluwadara ,
Itβs issue of your variable you are trying to find matches from. Itβs not issue of Regex namespace.
Check if the currentMatch
variable is available in the scope where you are using this code.
Thanks,
Ashok
ppr
(Peter Preuss)
June 12, 2024, 7:05pm
3
it looks like you had configured the loop var to currentItem but are using currentMatch
UPD1 - Visualization Screenshot added
1 Like
@Yomi_Oluwadara , @ppr is right, you had used the wrong variable, pls replace the currentMatch
with currentItem
Thanks @ppr and @ashokkarale , that resolved that issue, however, another one popped up it has to do with Last
from this expression
System.Text.RegularExpressions.Regex.Matches(currentItem.ToString,"([A-Z]+([0-9]+)?)").Last.ToString
ppr
(Peter Preuss)
June 12, 2024, 7:34pm
6
give a try at
System.Text.RegularExpressions.Regex.Matches(currentItem.ToString,"([A-Z]+([0-9]+)?)").Cast(of Match).Last().ToString
@ppr
This is also throwing that error due to Last
System.Text.RegularExpressions.Regex.Matches(currentItem.ToString,β(?<=([A-Z]+([0-9]+)?)\s+)\d+β).Last.ToString
ppr
(Peter Preuss)
June 12, 2024, 7:39pm
8
we inserted Cast(of Match)
and did not use Last without the brackets
1 Like
Thanks @ppr and @mukesh.singh , I have noticed there is a huge diff in bahavior between versions of studio
ppr
(Peter Preuss)
June 12, 2024, 7:50pm
10
@Yomi_Oluwadara
It looks like it is now working, So close the topic by marking the solving post
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has foβ¦
not really, as most of the things are coming from the .Net Plattform
using the Match Activity returns an IEnumerable(Of Match)
we do not the cast for using the Last Operator
using the Regex.Matches returns the MatchCollection
in Legacy we use the cast(Of Match)
in Windows we can maybe omit
We use the Last Operator always with the Brackets
LINQ (Language-Integrated Query) is part of the .NET framework and offers capabilities for interacting with data, objects, or other sources within a particular syntax. This HowTo elaborates on the availability of LINQ and explores the offered functionalities
Current Version of this topic is DRAFT and will be finalized / enhanced soon
Introduction
Letβs recap the Example of LINQ from [HowTo] - First Start with LINQ (VB.Net) .
Sample data:
myNumbers | List (Of Int32) = {12,34,5,8,10,2,15,7}.toβ¦
UPD1 - spelling and styles
system
(system)
Closed
June 15, 2024, 7:51pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.