I want to validate input in a C# TextBox by using regular expressions. The expected input is in this format:
CCCCC-CCCCC-CCCCC-CCCCC-CCCCC-CCCCC-C
So I’ve got six elements of five separated characters and one separated character at the end.
Now my regex matches any character between five and 255 chars: .{5,255}
How do I need to modify it in order to match the format mentioned above?
Update: –
If you want to match any character, then you can use: –
Explanation: –
Note: – The below regex will only match pattern like you posted: –
You can try this regex: –
Explanation: –