Examples
Some example of validation expressions are as under
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
(${phone_no} != '' or ${email_address} != '')
[This condition should be put in the note field and the note field should be made mandatory]
Time is within 10 AM to 6 PM
input_time
. >= '10:00' and . <= '18:00'
Validate GPS coordinates within a specific area
location
.[0] > -2 and .[0] < 2 and .[1] > 34 and .[1] < 38
[checks that latitude is between -2 and 2, and longitude is between 34 and 38]
Check if name contains only alphabets
name
regex(., '^[A-Za-z ]+$')
Note - . (dot) refers to the current field that needs to be validated
Last updated