Follow

Pattern-based Validation

 

What does it mean to "Validate with a pattern"?

For fields of the "Text" type, we offer the ability to "validate with a pattern." By default, text fields will accept any type of data. A pattern constraint allows you to customize your own field validation so that you can enforce your own formatting and content rules on that field. Pattern validations are based on regular expressions.

What is a regular expression?

Regular expressions, also referred to as regex or regexp, provide a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. They are typically configured by web-developers (but we provide some samples below).

Below are some helpful resources:

Wikipedia page on regular expressions:
http://en.wikipedia.org/wiki/Regular_expression

A java reference for regular expressions:
http://www.wellho.net/regex/javare.html

An online testing tool for java-based (java.util.regex) regular expressions:
http://www.fileformat.info/tool/regex.htm

What do I use for the "Pattern Description"?

It can be difficult to determine what a regular expression does just by looking at it. Therefore we added another field where you can write a description of the validation being performed by your regular expression. Keep in mind that this description will be visible by your lead Sellers so make your description detailed enough so that it is easy to understand.

Examples of commonly used pattern validations

DescriptionExample DataPattern
Letters only (exactly one, mixed case) a [a-zA-Z]
Letters only (one or more, mixed case) AbcDe [a-zA-Z]+
Letters only (zero or more, mixed case) null OR Abc OR ABCD [a-zA-Z]*
Digits only (exactly one) 1 OR 2 OR 3... [0-9]
Digits only (exactly nine) 012345678 [0-9]{9}
Digits only (one or more) 12 [0-9]+
Digits only (zero or more) 12345 [0-9]*
Letters & Digits (exactly one, mixed case) A OR a OR 8 [a-zA-Z0-9]
Letters & Digits (exactly one or more, mixed case) Abc123def [a-zA-Z0-9]+
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

You must be logged in to comment.