Can some one please help me to convert the following the PHP stuffs to .Net?
I don't enough idea in .Net and I need a regular expression to washout the junk chars from a decrypted string.
function clean($val) {
return preg_replace('/[^A-Za-z0-9\-|||!@#$%&*. ]/', '', $val);
}
echo clean($val)
You can do it this way in C#:
private string CleanStr(string val)
{
return Regex.Replace(val, @"[^A-Za-z0-9\-|!@#$%&*. ]", string.Empty);
}
And then in the caller:
Console.WriteLine(CleanStr("<<<Go>>>"));
Result: Go