How to extract a particular part of a string in uipath

Hello Friends,
Could you please suggest to me how to retrieve a part of a string?
For example
1. 1511 January
2. 1233 February
3. 1221 March

in output, I need only January(Only Char value) and not 1511(int value), every time I have a new string like above I wanted only char value.
Can anyone suggest the logic for the same?

Hi @Bot_Learner

You can try with split function!

Inputstring.split(" "c)(1)

Will result month only!

Regards

1 Like

Hi @Bot_Learner

Use Assign Activity

LHS β†’ Create an variable
RHS β†’ System.Text.RegularExpressions.Regex.Match("Inputstring","(?<=\d{4}\s)(\S+)").Tostring

Alternative method : 2

Use Assign Activity

LHS β†’ Create an variable
RHS β†’ System.Text.RegularExpressions.Regex.Match("Inputstring","\D+").Tostring

Alternative Method 3

Use Assign Activity

LHS β†’ Create an variable
RHS β†’ Split("1511 January"," ")(1)

Alternative Method: 4

Use Assign Activity

LHS β†’ Create an variable
RHS β†’ Split("1511 January"," ").Last

Regards
Gokul

1 Like

regex approach:
grafik
Anchored:
grafik

2 Likes

Hello, Friends @ppr @Gokul001 @pravin_calvin Thanks for the help.

Actually sorry I gave the wrong example
e.g.
1511 First January

wanted Output Like:
First January

in output, I need only First January(Only Char value) and not 1511(int value), every time I have a new string like above I wanted only char value.
Will the above solution’s work for this example also.

This regex will get that too here is the updated link

Regards
Gokul

1 Like

grafik

As \D was doing
grafik

as an opposite we also can replace all Digits with empty String

1 Like

@ppr @Gokul001 @pravin_calvin
Thanks, it works :+1:

HI @Bot_Learner

Kindly mark the appropriated post as solved. It will help for other too

Regards
Gokul

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