'default value' or 'fill-up' in RegEx?
Posted: Thu Oct 30, 2008 3:57 am
Hi regex-gurus!
I´m getting crazy with a 'little' Problem in regex. All i want is a number which allows this Format "nn,nn"
So i made this regular expression: ([0-9][0-9])?,[0-9][0-9]
It works fine, but when the user just enters "12" then it should result in "12,00" so that he don´t always have to enter "00".
You understand what i mean?
How can i explain in regular expressions that the number should be filled up with "00" behind the "," if the user just entered 2 numbers?
Thanks for your help!
Greetings from Austria
Tom
I´m getting crazy with a 'little' Problem in regex. All i want is a number which allows this Format "nn,nn"
So i made this regular expression: ([0-9][0-9])?,[0-9][0-9]
It works fine, but when the user just enters "12" then it should result in "12,00" so that he don´t always have to enter "00".
You understand what i mean?
How can i explain in regular expressions that the number should be filled up with "00" behind the "," if the user just entered 2 numbers?
Thanks for your help!
Greetings from Austria
Tom