Follow

Student Custom Fields: Validation Options (Custom Field Pattern)

We strongly suggest you submit a support ticket for additional guidance when using this field.

Rather than providing a limited set of data validation options for these custom fields, EdReady allows you to define almost any expected data format in the Custom Field Pattern field. This field accepts Javascript Regular Expressions - the entries will be used to validate the student-entered data and make sure that it is correct. Some common regular expressions are below: if these meet your needs, you can copy-and-paste them into the Custom Field Pattern field. Regular Expressions are quite powerful and flexible, so you are not limited to the examples listed here. All custom field patterns must start and end with a forward slash (/).

Type of Information Custom Field Pattern

Phone Number (with Area Code)

 

 

 

 

/^[1-9]\d{2}-\d{3}-\d{4}$/

We suggest you use the following error message:
Please enter a valid phone number in the following format: 123-456-7890

 

---------------------------------------------------------------

Email Address

 

 

 

 

 

/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/

This pattern will validate that the text has the format of an email address, not that it is a valid email address

 

---------------------------------------------------------------

Specific length of text

 

 

 

 

 

/^\D{10,13}$/

This pattern will only accept letters (not numbers), and the total number of characters must be between 10-13.

 

---------------------------------------------------------------

Specific number of digits

 

 

 

/^(\d{#})$/

Replace the “#” above with the number of digits you want. For example, if you’re looking for a set of 8 digits, the expression would be: /^(\d{8})$/

Note: any time you want an exact match, start off our validation with this: /^YourPatternHere$/

(replace ‘YourPatternHere’ with the pattern that meets your needs)
The ^ anchor means that the sequence has to start at the beginning of the line (character string), and the $ means that the sequence ends at the end of the line (character string). So your value string mustn't contain anything else, or it won't match.

When using the Field Pattern, it is important to ensure that your pattern is correct. To test your pattern, click the Test My Pattern button. 

A pop-up window will open, pre-populated with your Custom Field Pattern. You can try different text entries in the Test Input field - click the Test button to see if your input matches the specified pattern. You can also make changes to the Pattern in this window.

When you’re done testing, click the Close button to return to the main General Info tab. If you have made changes to the Pattern that you would like copied back to the main ‘Custom Field Pattern’ input, click the Update and Close button.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments