2

my regular expression is like,

//    [RegularExpression("^[0-9]*$", ErrorMessage = "must be numeric")]
    [RegularExpression("^[\u0660-\u0669]{10}$", ErrorMessage = "must be numeric")]
    public Nullable<int> DecisionNumber { get; set; }

I am using one Regular expression at a time when i use first one [0-9] it works fine and only allow me to type english number 123... etc

But in second expression it allow me to type english number not arabic number. On english number it gives error must be number

How can i write expression for arabic number up to 10 digits.

Hopes for your reply

Doc
  • 179
  • 1
  • 18
  • no it allow to type arabic number like ١٨ up to ten digits – Doc May 27 '20 at 13:45
  • I want expression that allow arabic number up to ten digits. My regular expression is not working. should i change decision numbet datat type to string ? – Doc May 27 '20 at 13:53

1 Answers1

1

Try this

[RegularExpression("^[\u0660-\u0669]{1,10}$", ErrorMessage = "must be numeric")]
public string DecisionNumber { get; set; }

The ^[\u0660-\u0669]{1,10}$ regex will match 1 to 10 Arabic digits. The DecisionNumber should be of type string.

Ryszard Czech
  • 18,032
  • 4
  • 24
  • 37