function escapeRegExp()

in lib/substitute.ts [10:12]


function escapeRegExp(s: string) {
  return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}