Problem with regex

Hello everybody

1. What is the problem? Be very detailed.

I have a validation with regex in the constraint of the form since it works correctly in the file in the online test environment (https://getodk.org/xlsform/) but being in the latest version of ODK Collect 1.27.1 it does not work .

The conditions are as follows: regex (., '[A-Z]') and regex (., '[A-ZA-Z]')

2. What app or server are you using and on what device and operating system? Include version numbers.
Aggregate 1.7.3 y ODK Collect 1.27.1

3. What you have you tried to fix the problem?
NA

4. What steps can we take to reproduce the problem?
I attach the test file with the question

test.xlsx (187.5 KB)

Can you perhaps describe what constraint you are attempting to enforce? eg a specific string that should match vs one that should fail... FYI the ones above will check for the presence (one or more occurances) of an uppercase letter in your string.

FYI, you should probably be aware that there is a slightly different behavior wrt the regex() function between Collect and Enketo; documented here: https://github.com/getodk/javarosa/issues/531

Net is that you should probably include the ^ (start string) and $ (end string) delimiters in your regex expression, otherwise it'll match any substring - depending on what XForm client you use... So, for example, if you want to make sure a string contains only uppercase characters, try:

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

2 Likes

Thanks for the help, indeed they were the limiters of the regex