我需要相匹配的貨幣在此值的類似正則表達式:Regex for Money爲逗號JavaScript正則表達式分隔小數
即「1000」,「1000,0」和「1000,00」
,但我需要使用JavaScript來的工作:
var RE = /^-{0,1}\d*\.{0,1}\d+$/; //validates decimal format such as 1000.50
if (locale == "fr") {
RE = \d+(?:,\d{1,2})? //this line fails when validated using the javascript below
}
return (RE.test(valueToValidate));
可能重複的[正則表達式爲貨幣](http://stackoverflow.com/questions/1028221/regex-for-money)在那裏發佈的正則表達式將沒有不同的JavaScript ... – Esailija 2012-01-18 15:44:49
我不清楚什麼是什麼你想要正則表達式匹配和不匹配。 – jfriend00 2012-01-18 15:46:54