Bad escapement JSHint

javascript, jshint

Solution

Just double escape the `\`

var regexS = '[\\?&]' + name + '=([^&#]*)';

Even though I'm guessing you'll be using this string for a `Regex` object, characters in a string must be escaped correctly. By default, a `\` attempts to escape the next character. If you add an extra one to be like `\\`, it escapes the original `\` and evaluates to a single `\` in the final string.

Problem

Does anybody know why I get a `Bad escapement` error on JSHint using the follow code? ``` var regexS = '[\?&]' + name + '=([^&#]*)'; ```

Original source