Restrict string data type for serial number

Hello everyone

I've just embarked on my first ODK questionnaire and am slowly getting the grips on regex validation codes.
So far, I managed to create some simple regex codes, however, with the one for my beneficiary serial number I seem to be stuck.

Basically my beneficiary serial number consists of 5 building blocks that the interviewer has to create:
[year][beneficiary category][first letter of the name of the community][first three letters of the beneficiary's first name][start time of the interview]

for example: 2019JEKNIN1011

In order to avoid typing errors, I would like to "guide" the interviewers in the sense, that they only have the necessary letters or number available for each building block.

For this I have come up with this regex code:

Unfortunately it doesn't work and I can't find out why. Is it the fact tat I am restricting it for only certain letters? And if so, what do I have to change for it to work?

I would greatly appreciate your help with my validation code.


PS: I am using Windows 10, Firefox to create the questionnaire and KoBo Collect Version v.1.14.0a to test it.

Is your beneficiary category 1 letter (as in your regex) or 2 (as it might appear to be in your example)?

I have the following beneficiary categories:

this is why I actually didn't want to limit the letters for the category building block.
but it looks like I did?

PS: sorry, I didn't explain my example:
2019[year]JE[beneficiary category]K[first letter of the community]NIN[first three letters of first name]1011[start time of interview]

Then instead of [EJMOP] you’ll need to explicitly list the 4 categories; try this instead :


And that’s a vertical bar ‘|’ not a capitol i

Thank you for your help.

So I entered the following regex code:

Unfortunately, in Kobo Collect it doesn't work.
It doesn't let me pass on to the next question if I enter my example:

I think you should be using (JE|PME|PEP|OP) instead of [JE|PME|PEP|OP]:

Corrected regex:

I have tried above here:

Hope this would help!

yessss, it worked!

Correct, there is a significant difference between the () operation and [] operation. See