I am trying to write a regular expression that will allow me to enter all the characters on the keyboard (even space), but limits the input to a comma at the end of the line. I tried to do this, including all possible characters, but it still does not give me the correct result:
[RegularExpression("^([a-zA-Z0-9\t\n ./<>?;:\"'!@#$%^&*()[]{}_+=|\\-]+,)*[a-zA-Z0-9\t\n ./<>?;:\"'!@#$%^&*()[]{}_+=|\\-]+$", ErrorMessage = "Comma is not allowed at the end of {0} ")]
source
share