Phone number constraint

Hi All,

I want your advice on putting a constraint on integer field to limit it to 10 digits and accept 077/078/079 in the beginning like (0772314223) or (078121324) or (0799124355)

Please Advice,

Try this:

constraint="regex(., '^07[7|8|9][0-9]{7}$')"

See Regular Expressions for details, and/or have a play around with regex's on https://regex101.com/ :slight_smile:

Description:

  • ^ asserts position at start of a line
  • 07 matches the characters 07 literally (case sensitive)
  • Match a single character present in the list below [7|8|9]
    7|8|9 matches a single character in the list 7|89 (case sensitive)
  • Match a single character present in the list below [0-9]{7}
    {7} Quantifier β€” Matches exactly 7 times
    0-9 a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
  • $ asserts position at the end of a line
2 Likes

Hello guys
I have tried all your constraints concerning limiting the phone number digits to 10 but i hav failed. Ineed your help pleaseπŸ™

hello @Joseph_Mugisha
use regex(., β€˜^[0-9]{10}$’) on your constraints

2 Likes

Thank u it worked man