I have this string of proxy addresses, they are separated by an space, however x400 and x500 handles spaces into their addresses. What's the best approach to split it.
e.g.
smtp:[email protected] smtp:[email protected] smtp:[email protected] X400:C=us;A= ;P=mygot;O=Exchange;S=John;G=Gleen; SMTP:[email protected]
Expected result:
smtp:[email protected]
smtp:[email protected]
smtp:[email protected]
X400:C=us;A= ;P=mygot;O=Exchange;S=John;G=Gleen;
SMTP:[email protected]
thanks,
EDIT,
string mylist = "smtp:[email protected] smtp:[email protected] smtp:[email protected] X400:C=us;A= ;P=mygot;O=Exchange;S=John;G=Gleen; SMTP:[email protected] X500:/o=Example/ou=USA/cn=Recipients of /cn=juser smtp:myaddress";
string[] results = Regex.Split(mylist, @" +(?=\w+:)");
foreach (string part in results)
{
Console.WriteLine(part);
}
Result
smtp:[email protected]
smtp:[email protected]
smtp:[email protected]
X400:C=us;A= ;P=mygot;O=Exchange;S=John;G=Gleen;
SMTP:[email protected]
X500:/o=Example/ou=USA/cn=Recipients of /cn=juser
smtp:myaddress