Issue
I have designed the following RegEx:
'-?\\d{1,10}(?:\\.\\d{0,5})*(?:,\\d{0,10})?'
This expression can be used to represent positive and negative integers and decimal numbers (according to German format).
Here is what I want to change:
Only positive integers and decimal numbers in the range from 0 to 100 are to be entered.
What do I have to change in my RegEx? I would be grateful for your help.
Solution
Maybe I have overdone it with the (non)capturing groups, but here would be numbers between 0-100 including decimals:
Note that as it currently stands it needs one leading number before the optional decimal, so 0.012
would be acceptable but .123
would not be. The regex can be expanded to allow both but I think it's quite long as it is and can be accomplished with a copy-paste of the second group (making the integral part optional rather than the decimal part).
Answered By - David542
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.