Regex Expression with different format of string

Hi Team,

I need to get specific word from lines of mail body. Here, I am able to check every line from body of mail,but i need to get exact word from string.Kindly help me.

case 1: How to get Lavanya from the string

User name - Lavanya

case : 2 How to get Bindu from the string

User Id : Bindu

case :3 How to get Kiran from the string
Vdi Id “Kiran”

case: 4
How to get Saikumar from the string
Please change password user name : Saikumar and Let me Known
Please change password user name : “Saikumar” and revert me on the same subject line.
Please change password user name “Saikumar”

Regards,
Neelima.

Hi,

We can extract all the case using the following rule.

System.Text.RegularExpressions.Regex.Match(text,"(?<=KEYWORD\W+)\w+").Value

Can you try the below expression?

Case1:

System.Text.RegularExpressions.Regex.Match(text,"(?<=User name\W+)\w+").Value

Case2:

System.Text.RegularExpressions.Regex.Match(text,"(?<=User Id\W+)\w+").Value

Case3:

System.Text.RegularExpressions.Regex.Match(text,"(?<=Vdi Id\W+)\w+").Value

Case4:

System.Text.RegularExpressions.Regex.Match(text,"(?<=Please change password user name\W+)\w+").Value

Regards,

3 Likes

Thank you for quick response my issue got resolved.Can you suggest me how to learn Regex
Expression

Regards,
Neelima.

1 Like

Hi,

Unfortunately, I’m not familiar with good regex learning site in English because my native language is not English. However, the following post might helps you. (There are some links for good video etc)

Regards,

2 Likes

Thanks for your great help :clap:

1 Like

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