Can I have my data input entry strictly in this format: AH-PT-001-A

Can I have my data input entry strictly in this format: AH-PT-001-A. As this variable will define my patient id, I wanted to be sure, there is no error in this format.

Requesting you to kindly help me on this.

Hi @Priyanka,

That’s called regex : “regular expression” you can learn about it in this wonderful article: Restricting Text Responses With Regular Expressions — KoboToolbox documentation

Depending on which parts of it should be exactly the same, (I assumed they need to write AH-PT-and a 3 digit number-and a capital lettter ) you can use following.

regex(., '^AH-PT-[0-9]{3}[-][A-Z]{1}$')

Note that enumerators should enter exactly:
AH-PT-3 DIGIT NUMBER-CAPITAL LETTER BETWEEN A and Z

Hope this helps, if not, don’t hesitate to ask.
Best,

1 Like

Thank you Hakan…it worked.
I have re-coded it
regex(., ‘^[AHMLSIVR]{2}[-][PT]{2}-[0-9]{3}[-][ABC]{1}$’)

2 Likes

@Priyanka :clap: :heart: :partying_face:

Thank you Kal for your support.

1 Like