remove special symbols and extra spaces and replace with underscore using replace method
<p>I want to remove all special characters and spaces from a string and replace with underscore.
The string is</p>

<pre><code>    var str = "hello world &amp; hello universe";
</code></pre>

<p>I have this now which replaces only spaces</p>

<pre><code>      str.replace(/\s/g, "_");
</code></pre>

<p>The result I get is <code>hello_world_&amp;_hello_universe</code>, but I would like to remove the special symbols as well.</p>

<p>I tried this <code>str.replace(/[^a-zA-Z0-9]\s/g, "_")</code> but this does not help.</p>
