I’ve recently found the need to really optimise some C# code using regular expressions instead of using multiple statements to tidy up strings before processing the contents of those strings. Regular Expressions can really take some getting used too and certainly require time to really master to any degree. What is a Regular Expression? Here is a line of C# that will illustrate how to remove all the numbers held within a string:

[source:c-sharp]Regex regEx = new Regex(“[0-9]”);
stringtoclean = regEx.Replace(stringtoclean, “”);

During my brief look into using Regular Expressions I found a really neat tool called Expresso which is free to download and you can grab it here:


Mole v4.2 for Visual Studio
WPF, 3D, Windows XP Anti Aliasing

Leave a Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.