我想爲數字輸入做一個正則表達式模式。當用戶輸入數字時,逗號會自動將輸入的數字分開,如1,424或23,232。這是工作的罰款與正則表達式模式正則表達式的數字用逗號和可選.00
/^[0-9.,]*$/
但問題是,這種模式允許號碼之間的點(。)。我想使正則表達式像輸入可以允許.00在數字之間結束數字。但.00也是可選的。 允許的數量格式如下:
123312131256457.00
1233121312564
9,223,372
不允許號格式如下:
34.343455.3434
34353...
我花同樣的失去的時間,但簡化版,得到任何解決方案。請分享你的想法。提前致謝。
我的作品。 :-)。非常感謝jensgram – Pooja
這個正則表達式有一個問題:https://www.regex101.com/r/wSPhnv/4 –
它會匹配類似'123,456789.00'的東西,即它匹配有逗號模式的數字。 –