I want to strip all non-alpha numeric chars and replace the first char with "x" if it is a number.
I have figured out the stripping of non-alpha numberic chars with the regex below, but how do I replace the first char with "x" if it is numeric? I want to do both operations in the same regex.
I have figured out the stripping of non-alpha numberic chars with the regex below, but how do I replace the first char with "x" if it is numeric? I want to do both operations in the same regex.
Code:
string onid = Regex.Replace(m, @"[^\w]", "").ToLower();
if (Char.IsNumber(onid, 0))
{
onid = "x" + onid;
}