Regex Cheat Sheet
It seems that many people have a basic understanding of how a regular expressions works. Lots of people will ask me, and probably many of you, for help in writing regular expressions. A lot of these people have a basic idea of what they need when it is a simple regex. I would like to point those people towards a regular expression cheat sheet. Many people ask for regular expressions and can say what they are looking for in a regular expression. They will say something like:
<2 to 4 letters><optional space or dash><5 digits><optional space or dash><3 digits>
matching the following:
CS 10051 001
MATH 23021-012
ENG-39995-123
not matching the following:
A 10051 001
MATH 23021_012
ENGLISH-39995
From this simple description and a regex cheat sheet a basic regex can be made. There are obviously other considerations like the context of the strings, but a lot of people can state this much information. This makes creating the regex easy, and a lot more people should go and get some basic resources and learn to write regular expressions. You will be glad you did.
Check out my
ASP.NET Advice Blog. It is where I blog regularly.