Last Updated: February 25, 2016
·
180
· gifthlong

Sanitize input to be treated as a literal

dirtystring.replace(/([.*+?^${}()|[]\/\])/g, "\$1");