How do I use string.Format to enter a value into a regular expression, where that regular expression has curly-braces in it already to define repetition limitation? (My mind is cloudy from the collision for syntax)
e.g. The normal regex is “^\d{0,2}“, and I wish to insert the ‘2’ from the property MaxLength
Replace single curly braces with double curly braces:
If that makes your eyes hurt you could just use ordinary string concatenation instead: