title: remove a string from a file using nodejs
body: <p>I am trying to remove a string from <code>text.txt</code>. <code>text.txt</code> file contains following format of string</p>
  
  <pre><code>text/more/more.txt
  text/home.txt
  text/more/yoo/yoo.txt
  text/about.txt
  </code></pre>
  
  <p>Now what I am doing is watching a folder and when any of the above listed file, lets say <code>text/about.txt</code>, is deleted then <code>text.txt</code> file should automatically be updated to following</p>
  
  <pre><code>text/more/more.txt
  text/home.txt
  text/more/yoo/yoo.txt
  </code></pre>
  
  <p>For this I am using <code>hound</code> module to keep watching for delete event. And <code>replace</code> module to replace deleted path from <code>text.txt</code> file. Below is my code</p>
  
  <pre><code>watcher.on('delete', function(file, stats) {
  
      replace({
          regex: /file/g, // file is something like this text/about.txt
          replacement: '',
          paths: [path + '/text.txt'],
          recursive: true,
          silent: true,
      });
  
  });
  </code></pre>
  
  <p>But my above code does not remove particular string i.e. <code>file</code> from <code>text.txt</code> file. <strong>How can I solve this?</strong></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><code>file</code> in above code has this value <code>text/about.txt</code>.</p>