I have a text box that I created using .NET.
Using this text box, the user can only enter a numerical value. But don't start at 0. start at 1-9. after entering the user key in 1-9 on the first character, the user can enter 0.
Regex reg = null; reg = new System.Text.RegularExpressions.Regex("^[1-9][0-9]*$") return reg.IsMatch(str);
This is my regex expression. Using this, I cannot enter 1-9. but only 0 and the alphabet. But if I use ^ [1-9], I can enter a numerical value, but I can not enter 0.
I have already tried the whole answer that you all offer. But it still canβt work. This is not like I am not reading your entire answer.
here is a photograph.

I want to check for the first time, only the user can enter a numerical value, but start with a value that is not equal to 0 or the alphabet, but 1-9. After the first character, the user can enter only 0-9.
I use Int.TryParse, but I use this when I click the button to process.
reg = new System.Text.RegularExpressions.Regex("^[^0-9]");
that the regular expression takes only a numerical value from 0 to 9.
reg = new System.Text.RegularExpressions.Regex("^[^1-9]");
so that the regular expression accepts only a number from 1 to 9.
How to add a larger regex expression for the second character until the rest accepts numeric 0-9?
By the way, I don't care about 0.99 because the price is fixed here. not with 0.99 or 0.123 ..
Any other ways to do this? Thank you