Reputation: 1
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
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