I'm looking for a good duplicate closure target for these questions:
- Regular expression in javascript
- Why do I have to add double backslash on javascript regex?
- Javascript + Regex = Nothing to repeat error?
- Range out of order in character class in javascript
- JavaScript RegExp Differences
- JavaScript regex literal vs RegExp object
- Javascript RegExp different results from constructor and literal
- JavaScript and regular expressions: literal syntax Vs. RegExp object
- Why does this regular expression evaluate to false in javascript?
Basically, the problem with constructing a RegExp by calling RegExp constructor, but forgetting to double up the backslashes. Solution is to double up the backslashes, or just use RegExp literal (if applicable).
Ideally, the answer should cover how to do it in both ways, explain why doubling up the backslashes (with examples covering several constructs in RegExp), and advise which to use in which cases.
Some candidates I currently have:
<esc><esc>