Paste the literal text you want to match, optionally enable slash escaping for regex literals, then copy the escaped output to drop into new RegExp().
The regex metacharacters . * + ? ^ $ { } ( ) | [ ] and backslash are prefixed with a backslash so they are treated as literal text rather than pattern operators.
Only when building an inline /pattern/ literal. Enable it to also escape forward slashes. For new RegExp('...') you usually do not need it.
Yes. It uses the well-known pattern str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') recommended in the MDN RegExp guide.