Craig Gallagher Craig Gallagher - 2 days ago 5
C# Question

Regular expression lowercase letter followed by a number

I'm trying to get the hang of regular expression. I'm scanning through an xml file and I want to do is find any word starting with a lowercase letter fallowed by a number e.g.

c1234
I assume it's something like
[a-z 0-9]
but it's finding single characters instead of a whole word. Any ideas on how to do this would really be appreciated.

Answer

[a-z]\d+ will work just fine.

It looks for any lowercase letter followed by any amount of digits.

Comments