Substring Values

Hi Team,

I am reading some row lines using ForEach activity like below

  1. AAA BBB 22-3050 Introducing UiPath Studio
  2. 111 222 55-1004 Studio
  3. Sam Star 12-5006 Cloud Orchestrator

I wanted to extract all words after 22-3050, that is the output should be Introducing UiPath Studio
If i give the input as 55-1004 output should be Studio
If i give the input as 12-5006 output should be Cloud Orchestrator

1 Like

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(row("data").ToString,"(?<=\d{2}-\d{4}\s).*")

Regards,

3 Likes

Where i need to pass the for each item in your code?

1 Like

Hi,

Sorry. Above case is for “For Each Row”

In case of “For Each”, it will be the following.

System.Text.RegularExpressions.Regex.Match(item,"(?<=\d{2}-\d{4}\s).*")

or

System.Text.RegularExpressions.Regex.Match(item.toString,"(?<=\d{2}-\d{4}\s).*")

Regards,

1 Like

Hi
You can achieve this by using Matches activity in for each activity
RegexOption (?<=\d{2}-\d{4}\s).*

Thanks

1 Like

If I store the value in a variable how do I change my code?
Say in my question for input no 1.
I am storing the value 22-350 in a variable called test. How this test will be passed in your code?

Sorry to add this question in the middle

1 Like

Hi,

If you already have definite value, it will be following

System.Text.RegularExpressions.Regex.Match(item.toString,"(?<=”+test+”\s).*")

or

Strings.Split(item.toString,test)(1)

Regards,

3 Likes

Yoichi,

Thanks your code works fine :+1:

2 Likes

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