- Flexera Community
- :
- App Broker
- :
- App Broker Forum
- :
- Re: Expression to limit answers on a question
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't feel bad, Charlie. I've never been good at regular expressions either, which is exactly why I keep that website bookmarked! 😀
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim! I'm bookmarking this site for future.
