Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
Python

r"
(A|D)?R?(B|C|E|F)?(G[12]?)?L?S?(M[12]?)?
"

Description

In Ontario, Canada, license classes are combined on the drivers license. This regex will parse out individual classes from the combination.

Submitted by Gregory Holley - 9 years ago