Extract Data by using string manipulation operation

Extract data

I want to Extract Above data by using string manipulation operation

And i want to extract only
KJ93404
Garret Reising
Italy
out of that string

How to do this?

1 Like

Hi
This can be done like this
If the above string is in variable named strinput then

In assign activity
strinput = String.Join(“”,Strinput.ToString.Split(Environment.Newline.ToArray()))

Another assign activity like this

stroutput_1 = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?<=Client Id).*(?=Client Name)”).ToString.Trim

stroutput_2 = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?<=Client Name).*(?=Client Country)”).ToString.Trim

stroutput_3 = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?<=Client Country).*”).ToString.Trim

Or we still got many options From our forum to handle this
Like

Cheers @Sneha_Ambulkar

1 Like

@Sneha_Ambulkar

You can use regex for this

String bar = System.text.regularexpression.regex.match(your input,"(?<=Client ID:)(.*)").value.trim

Same you can use for other also

Thanks,
Aman

@Sneha_Ambulkar
You can get text one by one using Anchor Base.

Or else for your scenario try this,
CVAL.Split({VBLF},StringSplitOptions.None)(0).Trim.Split({":"},StringSplitOptions.None)(1).Trim
CVAL.Split({VBLF},StringSplitOptions.None)(1).Trim.Split({":"},StringSplitOptions.None)(1).Trim
CVAL.Split({VBLF},StringSplitOptions.None)(2).Trim.Split({":"},StringSplitOptions.None)(1).Trim

CVAL is a variable


i got an error when i assign
ClientID = System.Text.RegularExpressions.Regrx.Match(outClientInfo.ToString,”(?<=Client Id).*(?=Client Name)”).ToString.Trim
where ClientID is String variable

1 Like

That was a typo mistake buddy
It’s Regex not Regrx
That’s why

System.Text.RegularExpressions.Regex.Match(outClientInfo.ToString,”(?<=Client Id).*(?=Client Name)”).ToString.Trim

Cheers @Sneha_Ambulkar

1 Like

yes i got it.

Thank You!

1 Like

Awesome
Cheers @Sneha_Ambulkar

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