Hello! I feel like I'm really close with the answer but hitting a wall. I'm using a regular expression to constrain values for a web-only form. The pattern required is 2 uppercase letters followed by 6 digits.
Here's what I'm trying:
It almost works, except for it allows 7 numbers to be entered, and it needs to be only 6.
Help? i'm sure it's a simple fix staring me in the face.
Your expression meets your requirements, according to the test:
for example GS654321 is highlighted, whereas DQ7654321 is not.
So there should be another reason your regex does not work...?
Thanks for checking the expression & for the website to do so. That will be
a great tool in the future.
So the interesting thing is that in the published web form, the expression
is working as intended, but in the form preview in Survey123 Connect, it
allows 7 digits to be entered. So perhaps a S123 Connect bug?
That would appear to be the case...
I don't know if it would matter, but you could re-write the expression. You originally had:
I suppose you can see what happens if you do:
You could also see if approaching this negatively produces the same problem but this would make the expression much longer.
I tried that - same result.
Then I realized something else - the regex constraint IS working as it should. However, the presentation is misleading. On closer examination I realized that entering 7 digits triggers the constraint message, so that's good. The bad thing is that the text in the field stays red once the regex condition is met (2 alpha's+6 digits), which misled me to believe there was an error.
I'm sure users will be confused too, as the text stays red, even tho' the regex constraint is met. Users will think that what they've entered is incorrect, when in fact, it is valid.
Some more feedback....I wish that the constraint messages didn't appear in the web form, because it's super confusing to be presented with a message to enter valid values, even tho' nothing has been entered. I saw on other GeoNet postings that other users have encountered this, & that it will be addressed in a future release.
Thanks for the help & quick replies!