show / hide menu

Regular Expression

Regular Expression is a sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.
The below mentioned are the Regular Expression types that is implemented in the AppForms.

○  Custom Expression      : The field should accept the format which is given manually by the user.
○  Characters                     : The field should accept both, Upper case and Lower case (Ex: Abcd).
○  E-mail                              : The field should accept only e-mail formats (Ex : name@sitename.com)
○  IP address (IPv4)          : An IP address is binary numbers but can be stored as text for human readers. For example, a 32-bit  numeric address (IPv4) is written in decimal as four numbers separated by periods. Each number can be zero to 255. For example, 1.160.10.240 could be an IP address.
○ IP address (IPv6)            : IPv6 addresses are 128-bit IP address written in hexadecimal and separated by colons. An example IPv6 address could be written like this: 3ffe:1900:4545:3:200:f8ff:fe21:67cf
○  Lower Case                     : The field should accept only lower case letters.
○  Negative Numbers        : The field should accept only negative numbers (Ex: -123).
○  Numbers only                : The field should accept negative, positive and decimal numbers (Ex:-123.456)
○  Phone Number              : The field should accept only numbers based on the specific format (Ex: 123-123-12345).
○  Positive Number           : The field should accept only positive numbers (Ex:123)
○  Upper Case                   : The field should accept only uppercase letters (Ex: ABCD).
○  URL                                 : The field should accept only the URL format(Ex: http://google.com or http://www.google.com)
○  Zip Code                        : The field should accept only Zip code values with the specified format (Ex: 12345-1234).
○  Zip Code 5 Digits          : The field should accept the Zip code of only 5 digits (Ex: 12345).

numeric address (IPv4) is written in decimal as four numbers separated by periods. Each number can be zero to 255. For example, 1.160.10.240 could be an IP address.
○ IP address (IPv6)            : IPv6 addresses are 128-bit IP address written in hexadecimal and separated by colons. An example IPv6 address could be written like this: 3ffe:1900:4545:3:200:f8ff:fe21:67cf
○  Lower Case                     : The field should accept only lower case letters.
○  Negative Numbers        : The field should accept only negative numbers (Ex: -123).
○  Numbers only               : The field should accept negative, positive and decimal numbers (Ex:-123.456)
○  Phone Number             : The field should accept only numbers based on the specific format (Ex: 123-123-12345).
○  Positive Number          : The field should accept only positive numbers (Ex:123)
○  Upper Case                  : The field should accept only uppercase letters (Ex: ABCD).
○  URL                               : The field should accept only the URL format(Ex: http://google.com or http://www.google.com)
○  Zip Code                      : The field should accept only Zip code values with the specified format (Ex: 12345-1234).
○  Zip Code 5 Digits       : The field should accept the Zip code of only 5 digits (Ex: 12345).

Example:
Step 1: Create a form as shown below

Figure 1: Designer

Figure 2: Preview

Step 2: Set the Regular Expression for each control based on the conditions required for the form.

Step 3: The Regular Expression is set in the ‘Properties Session’ of the AppForms. Here, click on the ‘Validation’ and then click on the browse button in the ‘Regular Expression’.

Figure 3

Step 4: In the appeared window, enter the ‘Expression Type’. A format appears based on the selected ‘Expression Type’. Note: For the manual format insertion, the ‘Custom Expression’ column can be used.

Figure 4: List of Regular Expression Types
Figure 5: Example for setting the condition (txtchar)

Step 5: In the preview form, enter the values based on the conditions and click on the button which is set as a trigger. The values entered in the correct format will be accepted and the validation message will occur based on the wrong inputs.

Figure 6: The values inserted before clicking on the Save button
Figure7: The validation message (due to regular expression) on inserting the wrong input once the ‘Save button’ is clicked