how to use startsWith function and restrict it to one letter

0
Expectation : R1234, it should not accept any other character after R and it has to consider integer only
asked
2 answers
1

You can validate the input using Validation, type custom.

Where you vallidate the attribute using an expression.

 

Expression isMatch with a regex checking for your desired format

https://docs.mendix.com/refguide/string-function-calls/#isMatch

 

The format of your regex... Thats up to you or use something like https://regexlib.com/

 

image.png


 

 

answered
0

You may be better using a regular expression with the isMatch function. Try the following...

 

isMatch($YourString, 'R([0-9]+)')

That should match a string starting with R, followed by one or more digits.

 

https://docs.mendix.com/refguide/string-function-calls/#isMatch

 

I hope this helps.

answered