Regular Expressions 101

Community Patterns

123...7

Caltrans EA validation with optional XX-XXXXXX entry and C##-#????#

3

Regular Expression
.NET 7.0 (C#)

@"
\AX{2}-X{6}\z|\A(C?((0[1-9])|(1[0-2])))-[0-4][0-9A-Z]{4}[14]\z
"
n

Description

Checks validity of an EA number first two digits 01-12 followed by hyphen then a number from 0-4 and then 4 numbers or uppercase letters and ending in a 1 or 4 for example "05-1J7601". Adding a capital C to the beginning is also accepted "C05-1J7601", along with the entry of 2 X's hyphen and 6 X's "XX-XXXXXX"

Submitted by RDJ@Ct - a year ago (Last modified a year ago)