Description |
This uses named groups to extract the user and domain portions of an Active Directory user in user@domain format.
You can use the following c# code to convert this into domain\user format:
public string ConvertUserAtDomainToDomainUser(string userAtDomain)
{
return Regex.Replace(userAtDomain,
@"^(?<user>.+)@(?<domain>.+)$",
@"${domain}\${user}");
}
This regex is intended to provide extraction from valid user@domain strings rather than validate its format. |