# Examples

Some example of validation expressions are as under

| Example                                          | Field in Form             | Validation Expresssion                                                                                                                                               |
| ------------------------------------------------ | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Validate that a phone number is 10 digits        | phone\_no                 | regex(., '^\d{10}$')                                                                                                                                                 |
| End date is after the start date                 | start\_date, end\_date    | . > {start\_date}                                                                                                                                                    |
| Input number is between 10 and 100               | input\_number             | . >= 10 and .<= 100                                                                                                                                                  |
| Check that the input number is even              | input\_number             | . mod 2 = 0                                                                                                                                                          |
| Email address is valid                           | email\_address            | regex(., '^\[\w.%+-]+@\[A-Za-z0-9.-]+.\[A-Za-z]{2,}$')                                                                                                               |
| Input Date is within the last 15 days            | input\_date               | . >= today() - 15 and . <= today()                                                                                                                                   |
| Ensure that at least one of the fields is filled | phone\_no, email\_address | <p>(${phone\_no} != '' or ${email\_address} != '') </p><p>\[<em>This condition should be put in the note field and the note field should be made mandatory</em>]</p> |
| Time is within 10 AM to 6 PM                     | input\_time               | . >= '10:00' and . <= '18:00'                                                                                                                                        |
| Validate GPS coordinates within a specific area  | location                  | <p>.\[0] > -2 and .\[0] < 2 and .\[1] > 34 and .\[1] < 38 </p><p><em>\[checks that latitude is between -2 and 2, and longitude is between 34 and 38]</em></p>        |
| Check if name contains only alphabets            | name                      | regex(., '^\[A-Za-z ]+$')                                                                                                                                            |

**Note** - . (dot) refers to the current field that needs to be validated
