I have a text box(txt_to) which has values seperated by ; How can I split the values, and even if there is only one value the code should not through error.
I tried to split it with the following code but got an error
string[] recipients = Request.Form["txt_to"].Split(';');
Object reference not set to an instance of an object.
The values in the text box are either a email like (abc@aaa.com) or just a plain text like (Ios Group). the values in the text box are like abc@aaa.com; Ios Group. How to split the value and how to check whether it is email id or just a plain text
if(email id)
{
Do this
}
else if (Plain text)
{
Do this
}
RFC 2822 states that you can validate an e-mail with the following regular expression:
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?So you can do: