Regex for exactly 6 char, first must be a letter

asp.net, regex, vb.net

Solution

Use this pattern:

^[a-z][0-9]{5}$

This will match any Latin letter (lower-case unless using case-insensitive matching) followed by 5 decimal digits.

Note: You could use `\d` instead of `[0-9]`, but read this for an explanation about why they are different.

Problem

What is the regex that matches these examples(6 characters, first is a letter, others are numbers): ``` u78945 - valid s56123 - valid 456a12 - invalid 78561d - invalid 1234567 - invalid ``` i don't know if regular expressions are the same for every programming language. I need it for Regular Expression Validator control using VB ASP.NET.

Original source

Related problems