Liquid UI - WS Reference Library

4.5.1 Pattern Matching


Pattern-matching is used to mark a field as containing a specific pattern of alphanumeric characters. Liquid UI Mobile can then check the input against the patterns for each field and only proceed if the entries match the assigned patterns. The way this works is that once you enter input, the Mobile application will search each field for a match to the patterns contained in the user entry. Once a match is found, Mobile will check that the data entered in the field matches the assigned pattern. If the input does not match the pattern, or if no fields with matching patterns are discovered, the application will return an error in the Status bar at the bottom of the screen.

Typically, you will execute a 'done entering text' action to signify that you are finished entering data. This action can take a number of forms. Some common examples are pressing the Tab or Enter key or moving the cursor into another field. Actions that change an attribute but do not cause any action to occur, such as selecting a radiobutton or checking a checkbox also are actions that will send the 'done entering text' signal to Smart Attributes. In addition to the actions that send the 'done entering text' signal, there are also some user actions that will override the Smart Attributes instead of performing them. These actions are typically those that are intended to cause an action to occur and therefore should not be interrupted by the Smart Attributes. Examples of these are as follows:

  • Selecting a menu item
  • Choosing a pushbutton
  • Choosing an F-key
  • Pressing the Enter or Return key

There are two wildcard variables that you can use to define a particular pattern for a field. These are as follows:

?

The question mark character is used as a wildcard to match any alphanumeric single character. So three '???' could equal '100', 'cat', 'C1d', etc.

*

The asterisk character is used as a wildcard to match the beginning or end of any string of characters. So 'cat*' could be the equivalent of 'catastrophe', 'cat15marin59x', 'cat1', etc. Similarly, '*bin' could be the equivalent of 'Fizzbin', 'etcbin', 'stickbin' etc.

Examples

In the following example, we have three fields on a screen. These all have pattern matching applied and the patterns are as follows.

  • Field 1: Pattern is '???'.
  • Field 2: Pattern is 'bin*'.
  • Field 3: Pattern is 'am2-?00'.
  1. Enter input for each field. You can use the tab key to move from one field to another. The sample input will be '100' for Field 1, 'bin34789897' for Field 2, and 'am2-400' for Field 3.

  2. Mobile will check the input you entered against the pattern assigned to each field.
  3. Since the values assigned to each field matched the specified pattern, the process will continue. If a value does not match the pattern assigned to the field, Mobile will return an error message.
Note: Please note that in order to check the input against the patterns assigned to the field, you must also have the data validation smart attribute assigned to the field. Validation will be explained in more detail in the following section of this document.