Thread: RegEx
View Single Post
Old 07-29-2009, 12:14 AM   #1 (permalink)
buildakicker
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Smile RegEx

Hi all,

My other post seemed to be a little much?! Maybe this one will be easier...

I am trying to strip an input of any special characters using regExpressions, but am not quite understaning how to get rid of anything but letters and numbers. Isn't there a replace /(!@#%$*())/ all that with "" expression?

Here is what I have so far:

Code:
function updatelink()
{
	var atitle = document.getElementById("articleTitle").value;
	var result = atitle.replace(/(\s| | )+/gi, "-"); //replace spaces
	var clean = result.replace(/'/,""); //replace punctuation
	var postlink = document.getElementById("postlink");
	postlink.firstChild.nodeValue = clean;
	
}
How do I add more than the ' inside the var clean replace?

Thanks!
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote