title: Reshape String, inserting "\n" at every N characters
body: <p>Using JavaScript functions, I was trying to insert a breakline on a string at every N characters provided by the user.</p>
  
  <p>Just like this: <code>function("blabla", 3) would output "bla\nbla\n".</code></p>
  
  <p>I searched a lot of answers and ended up with a regex to do that, the only problem is, I need the user's input on the matter, so I need to stuck a variable on this regex.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>function reshapeString(string, num) {
      var regex = new RegExp("/(.{" + num + "})/g");
      return string.replace(regex,"$1\n");
  }
  
  reshapeString("blablabla", 3);
  </code></pre>
  
  <p>This is currently not working. I tried to escape the '/' characters, but I'm screwing up at some point and I don't know where.</p>
  
  <p>What am I missing? Is there any other way to solve the problem of reshaping this string?</p>