$val = $argv[1];
$
reg = "#[^a-z0-9\s-]#i";
$count = preg_match($reg, $val, $matches);
if ($count > 0){
echo "$val contains invalid characters\n";
print_r($matches);
this is php code ..Convert it into C# ....i think it helps u......
select as answer....