Text Column 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.
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 SharePoint 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 use the following regular expressions (please see http://www.regexlib.com/REDetails.aspx?regexp_id=711):
|Description||This accepts RFC 2822 email addresses||Matchesfirstname.lastname@example.org Name Surname email@example.com "b. blah"@blah.co.nz||Non-Matches||name firstname.lastname@example.org name."surname"@blah.com name@bla-.com|
Please compare the data from this table with the picture below in case the browser does not display all symbols.
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: http://www.regexlib.com