Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi please tell me the code for regularexpression validator in asp.net which will allow only space,underscore and alphanumeric character..........
Posted
Comments
ErBhati 12-Aug-13 3:40am    
search it on google...

Try:
[\s_A-Za-z0-9]+
(The plus just means "one or more")
 
Share this answer
 
What about reading the documentation[^]?
 
Share this answer
 
PHP
$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....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900