Split word which is in regex format

Hi,
i have used matches activity and regex pattern to fetch this sentence “Your password: 7116”. i have successfully fetch this sentence (Your password: 7116).Now i want to split this sentence an get only last 4 digit no i.e 7116 but it is in System.Text.RegularExpressions.Match format

Pl help how i split and fetch only last 4 digit no

Hi @Soni_Reddy1,
Take an assign Activity and create a variable and use this expression
System.Text.RegularExpressions.Match(inputvariable,“(?sim)\d+$”).Value

mark this as a solution if this helps.
Happy Automation!
Regards,
Aditya

while creating variable in assign activity what should be variable type

Hi @Soni_Reddy1,
It is a string variable
Regards,
Aditya

Hi @desineediaditya

i am using string variable type showing error pl check below screenshot
image

Hi @Soni_Reddy1,
Sorry for above reply use the below code in assign
System.Text.RegularExpressions.Regex.Match(inputvariable,“(?sim)\d+$”).Value

Regards,
Aditya

Hi @desineediaditya
I have used above expression still showing same error pl check screenshot
image

Hi @Soni_Reddy1,
image
Try using this and still not able to figure it out then check out this tutorial

Regards,
Aditya

Hi @desineediaditya

Thanks for your solution but sill i m facing same issue my input value is coming from for each value(list)

Hi @Soni_Reddy1,
Here you go just watch this video then you will be able to achieve this

Regards,
Aditya

Hi
It works Thank you so much

Hi @Soni_Reddy1,
Mark this as solution so that it will be helpful for others.
Happy Automation!
Regards,
Aditya

Hi @Soni_Reddy1

You can also achieve this by String Manipulation as shown below :-

str.Split(" "c)(2)

str.Substring(str.IndexOf("Your password: ")+"Your password: ".Length)

Below is the workflow for the same :-
MainPratik.xaml (6.9 KB)

Output :-
image

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

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