When we leave out the other, well-understood parts of the character class, this remains: [''-']
.
This construct has no use. It translates to “the character '
and the range from '
to '
“, which is syntactically valid in regex but functionally equivalent to [']
.
In the context of the annotated C# class property on the MSDN:
[RegularExpression(@"^[A-Z]+[a-zA-Z''-'\s]*$")]
public string Genre { get; set; }
it’s very likely simply a mistake by he tutorial author. The original intention is hard to guess. The following exactly the same thing.
[RegularExpression(@"^[A-Z]+[a-zA-Z'\s]*$")]
public string Genre { get; set; }
4
solved What does ”-‘ mean in ^[A-Z]+[a-zA-Z”-‘\s]*$? [duplicate]