Search code examples
c#regexregex-lookaroundsregex-negationregex-group

Regex for an alphanumeric of 8 character


I want a regex that matches this where A is alphanumeric. first four digits are fixed. 7PTCAAAA

Please help me

Examples:

7PTC69RT 7PTC67KM 7PTC689F


Solution

  • 7PTC[a-zA-Z0-9]{4}

    1. 7PTC matches the characters 7PTC literally (case sensitive)

    2. {4} Quantifier — Matches exactly 4 times

    Try this here