Wijmo UI for the Web
maskFormat Option
wijmo.input.wijinputmask Namespace > options type : maskFormat Option

Default value: ""

Determines the input mask to use at run time.

Syntax
$(function () {
    
    // Get value
    var returnsValue; // Type:  string
    returnsValue = $(".selector").wijinputmask("option", "maskFormat");
    
    // Set value
    var newValue; // Type:  string
    $(".selector").wijinputmask("option", "maskFormat", newValue);
        
});
var maskFormat : string;
Example
These examples show two ways to use RegEx values for the maskFormat option.
$(".selector").wijinputmask({
    maskFormat: /\D{3}-\D{4}/
});

$(".selector").wijinputmask({
    maskFormat: new RegExp("\\D{3}-\\D{4}")
});
This example shows how to use the equivalent of [a-zA-Z] regular expressions in the maskFormat option.
$("#masktext").wijinputmask({
    maskFormat:/[A-Z,a-z]*/,
    hidePromptOnLeave: true
});
Remarks

The property can be a string composed of one or more of the masking elements as shown in the following table.

Masking Element Description
0 Digit, required. This element will accept any single digit between 0 and 9.
9 Digit or space, optional.
# Digit or space, optional. Plus (+) and minus (-) signs are allowed.
L Letter, required. Restricts input to the ASCII letters a-z and A-Z. Valid letters are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, and OtherLetter.
? Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions.
& Character, required.
C Character, optional. Any non-control character.
A Alphanumeric, optional.
a Alphanumeric, optional.
. Decimal placeholder. The actual display character used will be the decimal placeholder appropriate to the culture option.
, Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the culture option.
: Time separator. The actual display character used will be the time placeholder appropriate to the culture option.
/ Date separator. The actual display character used will be the date placeholder appropriate to the culture option.
$ Currency symbol. The actual character displayed will be the currency symbol appropriate to the culture option.
< Shift down. Converts all characters that follow to lowercase.
> Shift up. Converts all characters that follow to uppercase.
| Disable a previous shift up or shift down.
H All SBCS characters.
K SBCS Katakana.
DBCS Digit
DBCS Katakana
Hiragana
All DBCS characters.
N All SBCS big Katakana.
Matches DBCS big Katakana.
Matches DBCS big Hiragana.
\\ Escape. Escapes a mask character, turning it into a literal. The escape sequence for a backslash is: \\\\
All other characters, Literals. All non-mask elements appear as themselves within wijinputmask.
Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.

The following table shows example masks.

Example Mask Description
00/00/0000 A date (day, numeric month, year) in international date format. The "/" character is a logical date separator, and will appear to the user as the date separator appropriate to the application's current culture.
00->L<LL-0000 A date (day, month abbreviation, and year) in United States format in which the three-letter month abbreviation is displayed with an initial uppercase letter followed by two lowercase letters.
(999)-000-0000 United States phone number, area code optional. If users do not want to enter the optional characters, they can either enter spaces or place the mouse pointer directly at the position in the mask represented by the first 0. For example: 
$(".selector").wijinputmask({
     maskFormat: "(999)-000-0000 "
});
$999,999.00 A currency value in the range of 0 to 999999. The currency, thousandth, and decimal characters will be replaced at run time with their culture-specific equivalents.

RegEx

The maskFormat value can also take the form of a regular expression. For example: 

\D{3}-\D{4} yields a Zip Code like this: (012-3456)

℡ \D{2,4}-\D{2,4}-\D{4}/ yields a phone number like: (℡ 012-345-6789)

\D{2,4}-\D{2,4}-\D{4} yields a phone number like: ( 012-345-6789)

Important: Only the following RegEx key words are supported.
Key Word Description
\A Matches any upper case alphabet [A-Z].
\a Matches any lower case alphabet [a-z].
\D Matches any decimal digit. Same as [0-9].
\W Matches any word character. It is same as [a-zA-Z_0-9].
\K Matches SBCS Katakana.
\H Matches all SBCS characters.
\A Matches any upper case DBCS alphabet [A-Z].
\a Matches any lower case DBCS alphabet [a-z].
\D Matches any DBCS decimal digit. Same as [0-9].
\W Matches any DBCS word character. It is same as [a-zA-Z_0-9].
\K DBCS Katakana
\J Hiragana
\Z All DBCS characters.
\N Matches all SBCS big Katakana.
\N Matches DBCS big Katakana.
\G Matches DBCS big Hiragana.
\T Matches surrogate character.
[] Used to define a combination character subset.
[^] Used to express an exclude subset.
- Used to define a contiguous character range.
{} Specifies a pattern.
* The short expression of {0,}.
+ The short expression of {1,}.
? The short expression of {0,1}.
See Also

Reference

options type
wijinputmask jQuery Widget