I'm pretty bad at Regex (C#), so I break things down into parts. The goal of the following series of Regex statements is to take an arbitrary string and reduce it to lower case of the format "this is a test of 4mg/cc susp".
This is what I've been doing:
// Test string
string str1 = @" This is\ 'a' test of 4mg/cc susp ";
// Remove special characters except for space and /
str1 = Regex.Replace(str1, @"[^0-9a-zA-Z /]+", "");
// Remove all but one space from within the string. Trim the ends.
str1 = Regex.Replace(str1.Trim(), @"\s+", " ");
// Convert all to lower case
str1 = str1.ToLower();
Is there a single Regex (C#) statement that can accomplish all the above?