8
I’m studying about the RegularExpression
, But I don’t quite understand.
In my Model
the property CPF
must be filled in by numbers only:
[RegularExpression(@"[0-9]", ErrorMessage = "CPF deve conter apenas números")]
public string CPF { get; set; }
I wanted to understand how to validate using Regularexpression.
If it should only contain numbers, why not use a
int
instead of a string?– dcastro