I have a single line question that uses Real Number as the format input and would like to change it using an expression so a user can only input the number 1 or the number 2.
I haven't found an expression that works and wondering if anyone has done this
āMay 26, 2022 03:56 PM
If you only have a finite list of possible answers, why use a single line text entry instead of a drop-down list or radio buttons? Try adding a new expression under Catalog Management > Expressions, and use the expression ^[12]$. This should only match if a 1 or a 2 is entered with no other characters. For what it's worth, regex101.com is a great resource if you need help with regular expressions.
āMay 26, 2022 06:08 PM
If you only have a finite list of possible answers, why use a single line text entry instead of a drop-down list or radio buttons? Try adding a new expression under Catalog Management > Expressions, and use the expression ^[12]$. This should only match if a 1 or a 2 is entered with no other characters. For what it's worth, regex101.com is a great resource if you need help with regular expressions.
āMay 26, 2022 06:08 PM
Should have known that Jim would come up with a better and quicker answer than I š I was going to suggest ^(?:[1-2])$
I never was very good at regular expressions!
āMay 27, 2022 07:50 AM
Don't feel bad, Charlie. I've never been good at regular expressions either, which is exactly why I keep that website bookmarked! š
āMay 27, 2022 10:01 AM
Thanks Jim! I'm bookmarking this site for future.
āMay 27, 2022 10:09 AM