title: How to insert # tag in each line using regex
body: <p>I am trying to insert # tag to each line using regex but its just replacing entire line can anyone help me please </p>
  
  <p>here is code what I tried </p>
  
  <pre><code>function copy() {
  
  var regex = /^(.*)/gm;
  var subst = '\#\1';
  var originaltxt = $('#result1').val().replace(regex, subst);
  $('#id1').html(originaltxt .trim());
  
  }
  
  &lt;textarea class="result" id="result1" rows="10" cols="150" style="font-size:11px;resize: none; width:225px;"&gt;
  User 1 prefix_ago 
  Hi How are you 
  User 2 prefix_ago
  I am good How about you 
   &lt;/textarea&gt; 
  &lt;button onClick="copy()" &gt; Copy &amp; Replace&lt;/button&gt;
  &lt;div id="id1"&gt;
  
  &lt;/div&gt;
  </code></pre>