开发者

regular expression for validating currency entered in a text Input in flex3

i have a text input box for entering the currency. it shud allow user to enter numbers from [0-9] and a . operator tht i did it.

now it shud allow 1 to 3(1 or 2 or 3) digits before decimal and 2digits after decimal. the range is betweem 0.00 to 999.99 how can i achieve this in flex3. if user entered 3 digits he shud not b able to enter 4th digit instead he has to type . as 4th char. previously i askd few questions in stackoverflow, i immediatley got the answers, who eve开发者_JAVA百科r answered i m really thankful to them. regards bagi


I do not know about flex, but my general regular expression approach would be the following:

/^\d{1,3}\.\d{2}$/

You could test for the users input on every keypress to determine if the input is valid, and reset the value to its previous content if this is not the case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜