How to pic two value from regex

Hi Frnds
I have a text “June 2009 - September 2014 (5 years 4 months)” from this I have to only pic the year value like -2009 and 2014 however while using matches activity I am only able to pick first value using the regex expression "(\d){4} ".
I am only receiving 2009

Format is same for all records ?

Thanks
@manish0077

yes it is same

Use this regex

(\d{4})\s.*(\d{4})

Group 1 and Group 2

Thanks
@manish0077

use matches activities to get the multiple matches.
string matches activities in UiPath.

its picking “2005 - April 2007” I only need 2005 and 2007 because I need to put the information into the system like started year and end year

\d{4} this will work fine!

its only picking first value from line I need both value

Yeah its getting full match but ive done it in groups i.e Group 1 is 2005 and Group 2 is 2007

Use it in for each loop and to access groups in regex use
item.group(0).value

Check the below link

Thanks
@manish0077

you can use for each loop and give regex out put value
and print it like this Item.ToString

Still confused how to implement this into uipath while use the provided regex its returning the full match value .
image

image

image

can you try this \d{4} @manish0077

The for Each type argument should be RegularExpressions.Match and inside loop write
item.Groups(0).Value

Thanks
@manish0077

2 Likes

Thanks a Lot @hasib08

1 Like

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