Is it possible to force correct use of capitalisation of text?

I did search first, honest!

Is it possible to force correct use of capitalisation of text? I’m looking to collect names & addresses & the prevalence of mobile devices, or just pure laziness, leads to no capitalisation. I then have to correct it manually as even Excel has limited options.

Welcome @aldercar,

You could control this with a regex contraint, see Number of any word name with Regex
and Restricting Text Responses With Regular Expressions — KoboToolbox documentation

1 Like

Thank you @wroos.

Do you know if the regex string would automatically capitalise or simply prevent the responder from starting with a lower case letter?

Neither, nor. It behaves like any constraint, see, please, Limiting Responses with Validation Criteria — KoboToolbox documentation.

You may also add a constraint_message, and a hint to the question to explain the rule.

1 Like

I’m afraid I don’t understand your post: Neither nor? Surely it must do one or the other.

Did you mean to repost the same link from your first reply, as I can’t see anything relevant there?

I’ll have a play & see what happens.

Sorry, corrected the link above.

Neither it will automatically capitalise, nor it will directly block to enter small letters. The constraint will “fire” and show an error (constraint_message) after the focus moves out of the entry field. And the user cannot finalise/send this form before correction.

There is also a complex option for automatic capitalisation/correction after the original entry. You would need to walk through the original entry field, searching for blank, hyphen, dot (etc.?) to localise a word beginning, then capitalise the following letter, and finally save the result in an additional variable. You might also need to make sure that all other letters are in small format (e.g. using translate() function).

Something similar could also be coded in Excel. For capitalisation with Excel, Word etc. see How to capitalize or change the case of your text in any app | Zapier.

It is rather easy if you only need to capitalise the first letter of an entry field, but becomes more ambitious if you have multiple words in one field and multiple separating characters.

You may use something like
[A-Z]{1}[a-zA-Z0-9.-\s]+
This will allow the first letter to be capitalized and then for hyphenated names, Jr., and other designations. But keep in mind names show great variations, e.g. McNeal, O’Brian.

You can find links for regex test tools here Limiting Responses with Validation Criteria — KoboToolbox documentation.

Keep in mind, please, that names, address etc. are sensitive personal data, requiring data protection policies for storage. So, you might even need to remove them before analysis.

1 Like

Thanks again for your time & effort. :+1:

1 Like