Replace Special Characters

K

kookie

I have a field I am using in the naming convention of the file. I need to
remove special characters because WSS does not support them. I can throw an
alert but I can not get it to replace the regular expression with a blank or
"". here is my code:
<code>

function removeRE1() {
var re1 = new RegExp("[\!\@\#\$\%\^\&\*\(\)\_\+\=\{\}\?\<\>\'\;]");
// Get the field value
var strMnPName =
XDocument.DOM.selectSingleNode("/my:myFields/my:MnPName").text;

// Find a match within string s
try {
if (re1.exec(strMnPName) != null){ // && eventObj.Operation == "Insert") {
XDocument.UI.Alert("Please remove any Special Characters!\n ! @ # $
% ^ & * ( ) _ + = { } ? > < ' ;");
strMnPName = strMnPName.replace(re1.exec(strMnPName),"");

}
}
catch (e) {
throw e;
}

}
</code>

Please help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top