lab.joelgillman.com

Sketches, Code Bites and Toys



Friends
Links

Escape User Input for JavaScript Regex

Escaping strings for regular expressions in JavaScript is pretty easy when you know what you’re doing. But say that the input is dynamic, possibly coming from an inexperienced user. That shit has got to be scrubbed! Unfortunately, there is no built in way to do that. Luckily it’s easy enough to add it in yourself.



© 2012 jgillman -¦- Go WordPress! -¦- RSS 2.0 Feed