Regular expresion for Spanish Double

Apr 29, 2010 at 5:42 PM

Hi, i´m using NHibernateValidatorRulesProvider for the client side validation of my application.

I have this property in my Product class:

public virtual double UnitPrice { get; set; }

 

It works well, but the code for [Digits(8,3] that it uses only accepts Float number with a dot like this: 8.4 and i need it to validate numbers like this: 8,4 .

 

This is the pattern it uses: 

pattern =string.Format(@"\d{{0,{0}}}(\.\d{{1,{1}}})?", att.IntegerDigits, att.FractionalDigits);

 

 

 

I tried 

 

pattern =string.Format(@"\d{{0,{0}}}(\,\d{{1,{1}}})?", att.IntegerDigits, att.FractionalDigits);

 

 

I have also tried:

[Pattern(Regex = @"\d{{0,{0}}}(\,\d{{1,{1}}})?")]

With no luck. See if you can find a solution.