1. Java Rosa
  2. javarosa
  3. Issues
Issue #61 new

regex failing

Yaw Anokwa
created an issue

Originally filed at http://code.google.com/p/opendatakit/issues/detail?id=546

"I have tried ^[0-9]{10}$ (type is string) to match exactly 10 digits and it works fine except when the first digit is zero. Have tried on version ODK Collect 1.1.7 and 1.2 and same result."

In the test case, I'm using ^[0-9]{5}$, and 012345 passes, but it shouldn't. Interestingly, regex(., '^[0-9]{1}[0-9]{9}$')" works...

Comments (3)

  1. Clayton Sims

    Hm, fascinating. I'm not super familiar with the regex library munaf integrated. I didn't think it supported the {} count syntax at all. I'll take a look and see if there's something obvious going on.

  2. Yaw Anokwa reporter

    The issue here is that JR saves the value of the prompt first. If the bind says integer, and you enter "0001", then it saves it as "1", and JR does regex on that value. Workaround is to use a bind of string.

  3. Log in to comment