Try this regex pattern
[ -]?[0-9]\d*(.[0-9]\d*)?
Remove the space present in the square brackets.
Its working.Thank you
Hello
I have a range value range = A1:F1658
and I want only 1658.
I use to get only numberic value but it gave me 11658
Getting error…
Matches is not a member function of RegularExpressions
Hi @Tech_Guru
I think it should be:
System.Text.RegularExpressions.Regex.Matches(inputstring,"[0-9]\d*(.[0-9]\d+)?")(0).ToString
I am trying to find if a file name contains a year inside it. Basically I am putting the file names in an array, and using “for each” to find if a file name has a 4 digit sequence that is more than 2000.
The problem is I can’t seem to find the right activities to do this. For example: The file name is “invoice2 2015” how can I make my sequence find 2015 - then do a specific action? Also if a file name is “invoice2 215” it should not do any action (basically it will go to the else side of the if statement)
Hi @mhnghali84,
Welcome to the UiPath Forum
Simply get your file name as String and pass that into a Regex Match method
Regex.Match() this will give you the matching year or otherwise use Regex.IsMatch() this will return you a Boolean value
Regex Pattern goes like:- (\d{4}) this will match 4 digit sequence or for more than 2000 you can use like this way ([2-9]{1}[0-9]{2}[1-9]{1}) this will match from 2001 to above years
Note: to use Regex you need to add the following namespace in imports in UiPath if you are using assign activities otherwise you can directly use Match Activity
System.Text.RegularExpression
Happy Automation
If it work can you please make it as answer. it will help others to resolve the same issue that face by you😉
can you please tell which datatype variable can be used?
Hello All, i have a captcha question saved as a string, need to extract the digits to find solution for different questions. Can someone help for regular expression method, thanks!
sample captcha string: str= “Which is the greatest No. ? 9,28,6 =”
where do I put that code? I have a “for each folder in folder” tool, I would like to extract the digits out of the names of the folders. then I have :add data row" tool so I can put it into excel.
U can use a variable with type system.collections.ienumerable
Eg
Vardigi=567 sawq
Num=System.Text.RegularExpressions.Regex.Replace(Vardigi.ToString,“\D”,“”)
Output is 567