Thread: RegEx
View Single Post
Old 07-29-2009, 03:24 PM   #5 (permalink)
tony
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

my bad, it is \W
so something like this would do
javascript Code:
var title = document.getElementById("articleTitle").innerHTML,
    postlink = document.getElementById("postlink"),
    postlinkcontent = postlink.innerHTML,
    clean = title.replace(/\s+/g, "_");
clean = clean.replace(/(\W)/gi, "");
postlink.innerHTML = clean + postlinkcontent;

it is better to use innerHTML than value, I think that is only for form elements, I am not sure.
tony is offline  
Reply With Quote
The Following User Says Thank You to tony For This Useful Post:
buildakicker (07-29-2009)