开发者

Force Decimal Regex

开发者 https://www.devze.com 2023-01-02 04:00 出处:网络
I\'m looking for a regex or a way to format the NumberValidator so that only decimal places are allowed.

I'm looking for a regex or a way to format the NumberValidator so that only decimal places are allowed.

开发者_高级运维

The domain="real" allows you to put integer values, but I need to force the user to but in 2.0 if they want an integer.

This is because they pass through a Castor mapping file, it complains if it gets an integer when it expects a decimal.

I dont want to restrict the number of decimal places, just insist that there must be a point, and a number after it.

Any help would be much appreciated.


I don't know Flex, but if I undrestand correctly, you're probably looking for something like /^-?\d+\.\d+$/. Or /^-?\d*\.\d+$/ if .1 is valid.

0

精彩评论

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