Constraint in a string field does not work properly as space count as a string

What is the problem? Please be detailed.

I used this constraint regex(., '^.{2,35}$') to restrict string length of a respondent name.Enumerators are collecting respondent name in the Bengali language.But problem is that spacing count as a string consequently user can skip this field using double space. But I want first two string should not be space.

What ODK tool and version are you using? And on what device and operating system version?

Using ODK collect v1.14.0. Samsung galaxy j6 Tab.

What steps can we take to reproduce the problem?

What you have you tried to fix the problem?

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi @ARIF_AZAD_KHAN

please try this regex: ^\S{2,2}.{0,33}$

@Grzesiek2010 this regex gets an error while uploading form.

Really? What is the error? Could you attach an example form?

I tested it using online tools like:
https://regex101.com/ and https://regexr.com/

1 Like

@Grzesiek2010 find the XLS form name_constraint.xlsx (11.6 KB)

name_constraint.xlsx (11.6 KB)

2 Likes

@aurdipas many thanks. it's working.

2 Likes