title: Regex Pattern to match Ticket IDs in Javascript (Prefix-Dash-Digits)
body: <p>I am trying to get a Ticket IDs in a log message to be wrapped with a link to the appropiate URL in Javascript. I am still relatively a newbie when it comes to regex.</p>
  
  <pre><code>Input:
  
  MYPROJECT-123 My Commit
  
  Output:
  
  (MYPROJECT-123)[http://url/MYPROJECT-123] My Commit
  </code></pre>
  
  <p>I am scratching my head in figuring out why my regex pattern will not work. Any clues?</p>
  
  <pre><code>var logMessage = "MYPROJECT-123 My Commit";
  var projectId = "MYPROJECT";
  
  var ticketPattern = new RegExp('/^('+projectId+'-*\d)$', 'g');
  
  var mdLogMessage = logMessage.replace(ticketPattern, "($1)[http://url/$1]");
  
  console.log(mdLogMessage);
  </code></pre>