JavaScript Remove special characters string not working
问题 I'm trying to remove special characters that could appear within my Google Analytics tags, as the special characters seem to be causing script errors in some versions of IE. I have this function: function removeSplChars(inStr) { inStr = inStr.replace(/[^a-zA-Z0-9 ]/g, ""); return inStr; } and there is the GA code that currently works: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '<c:out value="${profileId}"/>']); <c:choose> <c:when test="${(lastCmdName eq