RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Active Directory User@Domain Format
Expression
^(?<user>.+)@(?<domain>.+)$
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.
Matches
bill@microsoft | peter.gibbons@initech | blackbeard@jollyroger
Non-Matches
bil+microsoft | microsoft\bill
Author Rating: Not yet rated. Matthew Harris
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials