RegExp_Escape(String)

Code
    this.RegExp_Escape = function(s) {
        /*
        Purpose
            Properly escapes a string which is intended to be used as a literal string in a regular expression.
        Parameters
            s (string) = The string we are escaping.
        Version History
            1.0 2015.12.06 Tested by Russ Tanner.
        */

        return s.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');

    }

Last edited by Russ; 12/06/15 08:46 PM.

The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)