Reputation: 1
I have a simple text field in Retool that I would like to validate includes the substring "-demo" So anything like test-demo, jeremy-demo, etc. would be acceptable. I'm sure with extra thought I could prevent stuff after the -demo part too, but one step at a time..
The closest I've gotten is using the pattern \-demo
which is validating only when the string is EXACTLY "-demo" no more no less.
Using their own RegEx Tester (here) I've found /\-demo/g
to work, but it does not actually work in practice.
Upvotes: 0
Views: 457
Reputation: 723
I have found a Tool Online to Test Retool Regex Flavour: https://retool.com/utilities/regex-tester
In This tool the following pattern matches for "test-demo"
/\w+-demo/
Upvotes: 0
Reputation: 1
You can use the following expression to validate if the text field includes the substring "-demo":
{{/-demo/.test(textField.value)}}
I have tested this in Retool and it works for me.
Upvotes: -1