Regular expression to check that a specific email domain is being used.

Our organization has more than one email domain. On an internal web app, I want employees to register/update ONLY with a particular domain...

What would a regex look like that says they can put any username, but the domain MUST be
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[a-zA-Z0-9]+[@][dallasray]\.com$            forgot $ for end of line make sure it ends after com
seems a job for string functions in the programming language you are using, but if it needs to be regex:

Set case-insensitivity in the regex object.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

the regular expression i supplied said username must have at least one character that is a capital letter, number, or lowercase letter, but can have many more....if you have a limit then you can set that also...but you didn't supply one yet...

so here are some addresses that would work:

if you want to be all alphabets, remove 0-9  which means all numbers between 0-9

if you want it to start with a letter   then


oops and remove brackets from around dallasray in all my examples...that was a typo..


.* would allow the user to have a username like ?++--;;;'''???@#??#?@?  which would be hard to store in a database...

that's why you would use [a-zA-Z0-9]...etc...
smet, did you read my last will get bad usernames if you use .*...anyway, to each there own....

good luck...obviously, you're still free to use my examples though you awarded points to ddrudik...

smetterd, thanks for the question and the points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.