I am using ODK Collect v1.2 on Asus Transformer Pad TF300T with Android
4.1.1 OS. We are building our forms using XLSForms. I have a text field
type variable where my user must enter a 4 alphanumeric character response,
i.e., A13G, 2B99, ABC8, etc. The text response is any combination of
capital letters and numbers. I tried to create a regex constraint to add to
my XLSForm data dictionary to validate text response:*regex(.,'[A-Z][0-9]{4}')
*. Unfortunately, the regex constraint did not work and I do not have
experience writing this type of code. Can someone revise it so that I can
add it to my constraint field in XLSForms? Also, if there is a way to check
for all capital letters for the alpha characters, that would be great.
You're close. The expression you wrote matches an uppercase letter followed
by 4 numbers.
To match any combination of 4 uppercase letters and numbers, you would use *
regex(.,'[A-Z0-9]{4}')*
ยทยทยท
On Wed, Sep 12, 2012 at 1:38 PM, jfiore wrote:
Hello,
I am using ODK Collect v1.2 on Asus Transformer Pad TF300T with Android
4.1.1 OS. We are building our forms using XLSForms. I have a text field
type variable where my user must enter a 4 alphanumeric character response,
i.e., A13G, 2B99, ABC8, etc. The text response is any combination of
capital letters and numbers. I tried to create a regex constraint to add to
my XLSForm data dictionary to validate text response:*regex(.,'[A-Z][0-9]{4}')
*. Unfortunately, the regex constraint did not work and I do not have
experience writing this type of code. Can someone revise it so that I can
add it to my constraint field in XLSForms? Also, if there is a way to check
for all capital letters for the alpha characters, that would be great.