In the Survey123 Web Designer constraints I want my string field to only include letters, numbers, and spaces. My understanding is that the regex would be: regex(.,'^[a-zA-Z0-9 ]+$')... however this fails to publish.
I'm entering this in the UI in Web Designer
^[a-zA-Z0-9 ]+$I've tried many many different things and it seems like the fail happens because of how $ is being handled as is passes ^[a-zA-Z0-9 ]+$ from the UI to syntax. Excluding $ does not solve the issue - it publishes but passes the constraint no matter what is entered in the string.
Publishing seems to be taking what should be regex(.,'^[a-zA-Z0-9 ]+$') and turning it into regex(.,'^[a-zA-Z0-9 ]+)) and failing to publish.
.*['"].*works in the opposite way... like the constraint would only pass if my string includes a special character. So don't want that.
Goal:
Santa's Workshop = fail the constraint and show the message
Santas Workshop = pass the constraint and allow to submit
So how would I get this to happen if I can't use $ in the syntax without moving to survey123 connect??
ERROR WHEN PUBLISHING:
Hey @Teresa_Blader
Would it be possible to add the constraint in a hidden field?
https://community.esri.com/t5/arcgis-survey123-questions/hidden-field/td-p/845587
Once the hidden field is added, changing the default value to be this: "^[a-zA-Z0-9 ]+$" with quotes and everything, then once you're wanting to validate put in the validation section something like this:
regex(., ${pattern_helper})
I believe that the formatting is causing the issue, but the variable reference may end up passing this validation check.
Cody
That's such a great idea BUT regular expressions right now only allow "value" and "field" is not available in the dropdown 😭
