07-29-2009, 12:14 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Jan 2008
Posts: 119
Thanks: 21
|
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!
|
|
|
|