How to condition text fiels ENTER only in uppercase LIKE ABCDEFGHIJK please provide regex which work on xls form

ONLY ENTER CAPITAL ABC
PLEASE PROVIDE REGEX

ADVANCE THANKS

What have you tried so far? Do you have a sample form you can share with those trials?

1 Like

I want my enumerator enter only capital ABC in text field like LAHORE
not enter small latter abc in text field like lahore
only allow capital ABC

See this helpful document https://docs.opendatakit.org/form-regex
and you can see this discussion Use of regex on xlsform

Try this regex(.,[A-Z]+) Match a single character present in the list below [A-Z]+

  • Quantifier — Matches between one and unlimited times, as many times as possible.

Another alternative I am using now is instead to prevent lowercase in input, just to normalize to UPPERCASE using XPATH translate. The translate() function enables such things converting strings from lowercase to uppercase, by translate(${mystring}, 'abcde...', 'ABCDE...').

1 Like

Strictly speaking you should include the start ('^') and end ("$") string delimiters; ie

regex(.,'^[A-Z]+$')

otherwise your regex may match any uppercase substring, including non-uppercase letters at the beginning or end; eg

thisISFALSEmatch

would match on 'ISFALSE'

You are right! Thanks.

1 Like