How to get particular parts from string

Hey Everyone, the problem I am facing today is that I want to extract some data from a website.

I am using get text activity, but the problem is it is selecting the whole string but I want to extract some particular parts from the string.

Would you please help me out with this problem. I am attaching the screenshot for more clarity of my problem.

I want to extract “55283” and “Nierstein” but it is extracting “55283 Mainz-Bingen (Kreis) - Nierstein”

pp

Hi @Muhammad_Anas_Baloch

Number = Split(msg," “)(0)
Name = Split(msg,” “)(Split(msg,” ").count)

Hope this helps.

2 Likes

Hi @Muhammad_Anas_Baloch ,

From the Extracted Output, we can manipulate to get the required data :

Split(extractedValue).First                                   //First Number Output

Split(extractedValue,"-").Last                          //Last value

The above is assumed that all the data format will be the same, if the separators are only space and not -, for the second expression just remove the delimiter part.

Let us know what is the actual pattern and if the expression works for all the data that you have.

1 Like

Hi @Muhammad_Anas_Baloch

How about the Regular expression?

System.Text.RegularExpressions.Regex.Match(YourString,"^\d+").Tostring

image

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=-\s)\S.*$").Tostring

image

image

Regards
Gokul

2 Likes

Hi @Muhammad_Anas_Baloch

You can easily use Matches activity to compose a regular expression and use it extract what you want.


1 Like


Giving an error


Giving an error @supermanPunch

This Solution worked for me but in VB.net not in C#

This solution worked for me in C#.

Thanks for the info, i had same problem so I’ll try. Thank you so much!

1 Like

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