<!DOCTYPE html>

        <meta charset="utf-8" />
        <title>JavaScript Regular Expression to Replace Special Characters from String</title>
        <link rel="stylesheet" href="style.css" />
        <script data-require="jquery" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
        <script src="script.js"></script>
        <script type="text/javascript">
                function replaceCharacters() {
                        var regExpr = /[^a-zA-Z0-9-. ]/g;
                        var userText = document.getElementById('user').value;
                        alert(userText.replace(regExpr, ""));

                <h1>JavaScript Regular Expression to Replace Escape Special Characters from String</h1>
                 <h2>Enter Your Input Text</h2>
                <input type="text" id="user" value="Hello Anil' Welcome you  to#$% code-@!sample.$*^com" class="text" />
                <input type="button" id="btnRemove" value="Remove Special Characters" onclick="replaceCharacters()" class="success" />

// Add your javascript here
    "margin-left": "50px"
  }, "slow");
/* Put your css in here */

h1 {
        color: Green;

.success {
        background-color: #57A957;
        color: white;
        background-repeat: no-repeat;
        display: inline-block;
        height: 40px;
        vertical-align: middle;

.text {
        height: 36px;
        position: relative;
        border: 1px solid #cdcdcd;
        font-size: 14px;