I need a regular expression that matches currency values similar to here: Regex for Money
i.e. '1000', '1000,0' and '1000,00'
but I need it to work using 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));