Regex makes me feel like an idiot!

465
2
Jump to solution
02-26-2023 05:12 PM
TFC_GIO
New Contributor

OK,

I'm not a dummy, but I feel so stupid right now and I'm so frustrated that I want to cry.  I've tried, on several random occasions over the past few weeks, to try and figure out out how to get perhaps the simplest regex in the history of regex to work in a constraint in my survey.  I've tried literally EVERYTHING.  I've taken tutorials, googled my brains out, tested regex on regex101.com, but no matter how many times I think I've written something that will work, it just doesn't when I use it as a constraint in Survey123 Connect.  

All I'm trying to do is constrain a free text field in my survey to one, single word of any length.  

I'm too frustrated to recap what I've tried thus far and the lengths of finagling I've gone to in order to craft a regex that would do what I believe is a really, really simple validation. I'm hoping that there's someone in the community who would kindly drop the right way to write the  constraint expression in a reply.  

regex(.,'<whatever the heck forces only one word/no whitespace entered>')

Many thanks in advance to the first person who can save my sanity,

Amilynn

 

Tags (2)
1 Solution

Accepted Solutions
Kepa
by Esri Contributor
Esri Contributor

Hello @TFC_GIO,

This work for me for a single word of any length:

regex(., '^[A-Za-z]+$')

Regards,

 

View solution in original post

2 Replies
Kepa
by Esri Contributor
Esri Contributor

Hello @TFC_GIO,

This work for me for a single word of any length:

regex(., '^[A-Za-z]+$')

Regards,

 

TFC_GIO
New Contributor

THANK YOU!!  I'll give it a shot later today.  ❤️

0 Kudos