SharePoint Web Parts & Office 365 Apps by VirtoSoftware
HomeBlog Text Columns with Regular Expression Validation
Text Columns with Regular Expression Validation
SharePoint does not support validating values, and it is not required in some cases. However, if you try to build complex business processes based on entered data, it is critical to validate that users input correct data in the fields.
This article describes how to create an Email text field that validates regular expressions without any codes.
For this task, you need to download and install Virto Custom Mask and Unique Field Validation. This multi-purpose component allows you to create custom fields in design mode and check fields for unique criteria within the current list, site or site collection framework.
To start, create a new list where you will be creating the new text field or go to an existing list. Then go to Settings > Create Columns.
Title the name of your new field as “Email”. If you have Virto Custom Mask and Unique Field Validation installed, a list of column types will be available. Select “Virto Custom Mask”.
Once column type is selected, visual field editor will be available. It consists of several blocks.
Block 1 defines unique scope, automatic field case and separator between elements.
Block 2 contains mask preview which is refreshed automatically, but you can also refresh it manually by clicking the “Refresh” button.
Block 3 allows adding, deleting and adjusting mask elements.
Now, let’s add a text block. In order to do this, select “Text” in the “Select mask item type” section and click “Add”. You will see the following picture as a result.
This block is not editable by default. Check the “Editable” box to change this setting.
You need to define the Pattern for this block. This can be done by using regular expressions that will check if entered data is in the format of an email address.
You can define the text color in addition to basic settings. The following is the result of the template:
The field for inputting email address with validation settings is ready to use. Click “OK” to add this field to the list.
You will now have the menu options to create, edit and view forms of the list containing the new form for inputting email addresses.
Here are several screenshots of the created mask:
A library of regular expressions for new masks can be found at: www.regexlib.com.
About the author
Tatiana Sushchenko is the product owner at VirtoSoftware. She started her IT career with the famous ABBYY Lingvo back in 2006 in Moscow. Then she moved to Microsoft performing strongly in various marketing management roles across Visio, SharePoint, Office 365 and Project for almost 10 years. Tatiana is a graduate of the Institute of Business Studies and holds a mini-MBA degree. She also graduated from Microsoft marketing excellence university.