Login    Forum    Search    FAQ   Blog

Board index » Client-Side Development » Javascript




 Page 1 of 1 [ 3 posts ] 



Author Message
 Post subject: Replace otherthan alpha numerics with underscore
 Post Posted: Wed Aug 05, 2009 9:23 am 
Offline

Joined: Sat Feb 21, 2009 10:46 am
Posts: 34
Hi,

Replace otherthan alphanumerics with underscore in javascript i need regular expression,

its very urjent,

Thanks in advance


Top 
 Post subject: Re: Replace otherthan alpha numerics with underscore
 Post Posted: Wed Aug 05, 2009 9:23 am 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
Hi,


check the below regular expression

Code:
string source = @"~!@!@##@$%^&^&*test&*(*()_+{}|:>?<\";
            string result = System.Text.RegularExpressions.Regex.Replace(source, @"[^\w\-]", "_");


Top 
 Post subject: Re: Replace otherthan alpha numerics with underscore
 Post Posted: Wed Aug 05, 2009 9:23 am 
Offline

Joined: Sat Feb 21, 2009 10:46 am
Posts: 34
function valNumCharSpaceDotQuotes(evt)
{
var charCode;
charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90 || charCode >= 48 && charCode <= 57 || charCode==32 || charCode==8 || charCode==46 || charCode==39)
{
return true;
}
else
{
return false;
}
}


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 3 posts ] 




Board index » Client-Side Development » Javascript


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron