REGULAR_EXP
-
this code let me write optional 4 digits and 3 decimal 1234.000 const string REGULAR_EXP = "(^-?\\d{1,4}\\.$)|(^-?\\d{1,4}$)|(^-?\\d{0,4}\\.\\d{1,3}$)"; i don't understand why if i type a number for ex. 12 and then add a minus (-) in front it works, but it doesn't if you type first minus (-) and then the number. i want REGULAR_EXP to add optional minus (-) before u type a number
-
this code let me write optional 4 digits and 3 decimal 1234.000 const string REGULAR_EXP = "(^-?\\d{1,4}\\.$)|(^-?\\d{1,4}$)|(^-?\\d{0,4}\\.\\d{1,3}$)"; i don't understand why if i type a number for ex. 12 and then add a minus (-) in front it works, but it doesn't if you type first minus (-) and then the number. i want REGULAR_EXP to add optional minus (-) before u type a number
If you put an @ at the beginning of your string, you won't need to \\ your \'s, which makes the regex more readable. This doesn't always match what you'd hope, if you enter 3444.223, it will match the 3444. because that's the first test that works. You should change this to be all one regex, instead of three. However, the - part work fine for me in expresso. Your regex is working, what you need to explain is in what context you feel it does not work if you type the minus first. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer