Trying to get data but they end with the same word (except one has more words in front of it) (Makes more sense in the post)

So, sorry but it makes more sense in the post. Essentially I am trying to do this: I have two strings (Motor_2L) and (2L) and I would like to only grab the data after the 2L (2nd line). How would I go about this? It also does not want to seem to recognise ^2L.

image

@ktanli You can get the 2nd match from matches collection 2nd index

1 Like

How would I do that? Because I am using RegEx to build a datable, well the values would come through RegEx. Also, I am quite new to RegEx, so how would I do “2nd index”?

Hello

Further to @Arpit_Kesharwani‘s post.

Check out my Regex Megapost and look for the ‘groups’ section.

Hopefully that helps :slight_smile:

Cheers

Steve

@ktanli

You can set the value to datatable return from RegEx

Check below for your reference
https://forum.uipath.com/t/rpa-datatable-get-previous-row-column-value-set-to-current-row-column-value/256199/2

Hope this helps you

Thanks

I have a datable built that that looks like so (The middle column is the RegEx fomula): image. The thing I have to put it into the datable so I can grab the data and put it in excel. So for Cycle 2L, it took the right data, but for 2L, it is the same result as Cycle 2L. So do I basically have to do “INSERTVARIABLE(0).Groups(2).ToString” outside of the datable and input it in there later?

Hello @ktanli

I am a little confused :blush: - sorry about the late reply.

But I think the information you need is, the “^” does not work within anchors “(?<=TEXT)” in UiPath. If you remove the brackets from the above 2L Regex pattern then it will work but YES you would need to use Groups. If you use this pattern you will need to get Group 1 for the match.

Check this workflow for some possible solutions: Main.xaml (6.1 KB)

There is no Regex site that perfectly matches the Regex language in UiPath.

I use a mix of www.Regex101.com and http://regexstorm.net/tester to demonstrate answers.

Hopefully this helps.

Cheers

Steve