We are using the String Activity in this project

Create a workflow using string activities that extracts the First and Last Name of an employee from a text file and uses this information to fill in the placeholder text in the string below.

“Hello Mr/Ms/Mrs <first_name> <last_name>, we would like to invite you to our product launch event next week. Please confirm by the end of current week.”

First Name: John
Last Name: Doe
Age: 27
Email: John.Doe@localcompany.com

Hi @Kailash_Singh

Can you try the below

FirstName=System.Text.RegularExpressions.Regex.Match(Str_Input,"(?<=First Name: )\w+").Value
LastName=System.Text.RegularExpressions.Regex.Match(Str_Input,"(?<=Last Name: )\w+").Value
Template="Hello Mr/Ms/Mrs <first_name> <last_name>, we would like to invite you to our product launch event next week. Please confirm by the end of current week."
Result=Template.Replace("<first_name>",FirstName).Replace("<last_name>",LastName)

Regards,

1 Like

Hey @Kailash_Singh

use this value in assign

and attached the Xmal for your references :

input_msg.Replace(“<first_name>”, System.Text.RegularExpressions.Regex.Match(person_details,“(?<=First Name:).“).Value.ToString.Trim).Replace(”<last_name>“, System.Text.RegularExpressions.Regex.Match(person_details,”(?<=Last Name:).”).Value.ToString.Trim())


Regex.zip (1.6 KB)

Cheers :upside_down_face:

Thanks for this solution dear, It would be really appreciable. This means a lot for me.

1 Like

Hey @Kailash_Singh

I believe I optimized the code better than him in one assign activity .

cheers :upside_down_face:

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