Last Updated: February 25, 2016
·
183
· gifthlong

Sanitize input to be treated as a literal

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