SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a column of type "E-Mail" and we'd like to attach validation to it so it conforms to the normal regular expression email validations at a specific domain. Is this possible without writing a web part in Visual Studio? Thank you.

share|improve this question
up vote 2 down vote accepted

This codeplex project allows you to add regular expression validation to fields

Codeplex - SharePoint Custom Field Type - Regular Expressions

Be very careful trying to validate email addresses using RegEx though (either through this tool or javascript) - its seems like a ideal candidate for regex until you get into the details and there are a lot of samples out there that are wrong.

For example :-

  • Hardly any one will accept apostrophes in the email - yes o' is valid!
  • Many of the example out there will not accept TLD and this will only become unmanageable now that the restrictions on creating TLD's have been relaxed.
share|improve this answer

Other methods you can use:

  • Create a validation formula in the List Settings / Validation Settings.
  • Add some script to your forms to validate on the blur event or in the PreSaveAction

I prefer using script on the blur event because I can give immediate feedback to the user, as they are used to on other modern Web sites.

share|improve this answer
Thanks, Marc. I didn't know you could do that. – Alex C Jul 11 '11 at 11:40
I should have mentioned one other option, which is probably more the party line: a custom field type. I still like the script option better from a UX perspective. – Marc D Anderson Jul 11 '11 at 12:26
You could actually combine the two - a custom field type that uses javascript to do the validation client side as well as server side. – Ryan Jul 11 '11 at 14:56

This link gives you two different options. One that involves inserting a hidden web part in the EditForm for the list, and using JQuery to do the actual RegEx validation. Another option is to go with the third-party tool Christian refers to in the article.

share|improve this answer
Very nice. Thanks, Biilmann. – Alex C Jul 11 '11 at 11:40
Yes, of course - as Marc points out below - the built-in validation. I just tried it; a validation formula like =SEARCH(".",[Email],(SEARCH("@",[Email],1))+2)>0 will check for the "@" and the ".". However, in my setup, my custom error message when the validation fails does not display. SP just displays a standard validation message. Not sure why yet. So UX-wise, this is not the best, so far. – Biilmann Jul 11 '11 at 13:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.