$(this).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
/*For US number system (millions & billions)*/
$(this).replace(/\B(?=(?:(\d\d)+(\d)(?!\d))+(?!\d))/g, ',');
/*For Indian number system (lakhs & crores)*/
^ # Start of string.
(?: # Try to match...
0 # either a 0
| # or
[1-9]\d* # an integer number > 0, no leading 0 allowed.
) # End of integer part.
(?: # Try to match...
\. # a decimal point.
(?! # Assert that it's not possible to match
.*000 # any string that contains 000 from this point onwards.
) # End of lookahead assertion.
\d+ # Match one or more digits.
)? # End of the (optional) decimal part
$ # End of string.
6条答案
按热度按时间vptzau2j1#
这些将格式化相应系统中的值。
bqf10yzr2#
应该做你想做的事
说明:
在JavaScript中:
js4nwp543#
格式号1000000到12,34,567.00
kqlmhetl4#
印度货币RegEx
美国货币RegEx
brgchamk5#
印度货币数字转换RegExp
外币号码转换RegExp
exdqitrt6#
对于印度货币验证在regex表达式.你应该使用,它肯定是工作.
1.它不会在任何数字/金额前使用零和负号
下面是注解中的正则表达式。
String str="^^0-$";