up Inquisit Language Reference

mask attribute

The mask attribute constrains the text input allowed for a textbox or openended item.

Member of

<openended> <textbox> <xid>

Syntax

/ mask = constraint

or

/ mask = regex

Parameters

Name Type Description
regex string A regular expression.
constraint inputmaskenum
ValueDescription
alphabeticOnly letters.
alphaNumericOnly letters and digits.
creditcardNumberCredit card number.
dateDate specified as mm/dd/yyyy.
decimalReal numbers.
dollarsDollars and sense with optional dollar sign.
emailAddressValid email address.
europeanDateDate specified as dd/mm/yyyy.
integerInteger
ipAddressValid IP4 address.
negativeIntegerNegative integer.
negativeIntegerOrZeroNegative integer or 0.
positiveIntegerPositive integer.
positiveIntegerOrZeroPositive integer or zero.
socialSecurityNumberValid US social security number specified as nnn-nn-nnnn.
timeTime specified as hh:mm.
urlValid url address.
usTelephoneNumberPhone number specified as nnn-nnn-nnnn.
usZipCodePostal code specified as 5 digits and optionally a dash and 4 digits.

Remarks

The mask attribute provides a powerful set of tools for defining what type of text input is valid for a textbox survey item. It can be used, for example, to allow numberic only, or a date, a phone number in a specific format, or just about any pattern of text. Inquisit provides a set of built in patterns that can be used. If none of the ready-made patterns are appropriate, custom patterns can be defined using regular expression syntax. The web is full of resources for generating regular expressions that validate a wide range of input. For example, see https://utilitymill.com/utility/Regex_For_Range for a tool that generates expressions constraining input to a range of integer values.

Examples

The following restricts the input to a valid email address:

<openended email>
/ stimulusTimes=[0=enteremail]
/ mask = emailaddress
</openended>

The following restricts the input to an integer:

<openended integer>
/ stimulusTimes=[0=enterinteger]
/ mask = integer
</openended>

The following uses a regular expression to restrict the input to an integer from 0 to 100:

<openended integer>
/ stimulusTimes=[0=enterinteger]
/ mask = ^0*([0-9]{1,2}|100)$
</openended>

The following uses a regular expression to restrict the input to an integer from 0 to 200:

<openended integer>
/ stimulusTimes=[0=enterinteger]
/ mask = ^0*([0-9]{1,2}|1[0-9]{2}|200)$
</openended>

The following uses a regular expression to restrict the input to an integer from 1 to 99:

<openended integer>
/ stimulusTimes=[0=enterinteger]
/ mask = ^0*[1-9][0-9]?$
</openended>

Copyright Millisecond Software, LLC. All rights reserved.