Last Updated: February 25, 2016
·
163
· gifthlong

Sanitize input to be treated as a literal

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