title: How to change camelCase to slug-case (or kabob-case) via regex in JavaScript
body: <p>For some reason, <a href="https://stackoverflow.com/questions/22849950/how-do-i-replace-all-uppercase-letters-with-a-dash-and-lowercase-with-regex">this answer</a> I found for (supposedly) how to do it in php just gives me the wrong matches. 
  It seems to add the dash, but also replace the capital letter with a copy of the remainder of the string, so I want "abcZxc" to turn into "abc-zxc", but instead it turns it into "abd-zxczxc"</p>
  
  <p>This, plus a bunch of other variations, is what I've tried, but can't get it to work. </p>
  
  <pre><code>filterGroup = aNiceString;
  console.log(filterGroup.replace(/[A-Z]+/g, "-1$'"))
  </code></pre>
  
  <p>Thanks</p>