What does this expression return?
'a.b*c'.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
- 'a\.b\*c'
- 'a\$&b\$&c'
- 'a.b*c'
- 'a\\.b\\*c'
$& inserts the whole match, so each special character gets a backslash in front of it.'a.b*c'.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
$& inserts the whole match, so each special character gets a backslash in front of it.