The question is not only about identifying email address from a string. It is about replacing the found email address with the company email address.
For eg. if i have a string as below:
“Hi, My name is John Martin. I am a painter and sculptor. If you wish to purchase my paintings please look at my portfolio on the site and then contact me on john@gmail.com“
I would like to replace the above string with
“Hi, My name is John Martin. I am a painter and sculptor. If you wish to purchase my paintings please look at my portfolio on the site and then contact me on support@companyname.com“
The following code will replace all email strings that match the patern with your email id, the
Regexclass can be found inSystem.Text.RegularExpressionsnamespace