Truncate a String - variable name in regex

Not sure why the code below doesn’t work, any guidance appreciated

let num = 2;

str = "blablabla";
let regex = new RegExp("^\w{"+num+"}"); // this bit doesn't seem to replicate /^\w{2}/

str.match(regex);

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string

Thanks very much!

Here is the code that solved it

function truncateString(str, num) {
  // Clear out that junk in your trunk
  let regex = new RegExp(".{" + num + "}");
  let strTrun;

  if (str.length>num) {
    strTrun = str.match(regex) + "...";
  } else { 
    strTrun = str;
  }
  return strTrun;
}