Peter
Peter

Reputation: 1

Regex Expression - L.LL.#

I like to create regex expression that would check a string to make sure it starts with:

L.LL.#

Anything after this first number is an irrelevance. Is regex the best approach to solving this problem?

Note: The L implies a letter and the # implies any number.

Upvotes: 0

Views: 74

Answers (1)

Thomas Ayoub
Thomas Ayoub

Reputation: 29451

Use Regex.IsMatch(input, "^[a-zA-Z]\\.[a-zA-Z]{2}\\.\\d")

Assuming L represents a letter in the range A-Z or a-Z

Upvotes: 1

Related Questions