Replace '/', '\\' in key
335487
def _escape_path(key):
    '''
    
    '''
    return _tobytes(key).replace(b'$', b'$_').replace(b'/', b'$+').replace(b'\\', b'$$')
992209
def _escape_regexp(s):
    """"""
    return (
        str(s)
        .replace('|', '\\|')
        .replace('.', '\.')  # `.` has to be replaced before `*`
        .replace('*', '.*')
        .replace('+', '\+')
        .replace('(', '\(')
        .replace(')', '\)')
        .replace('$', '\\$')
    )
921929
function () {
                    var str, j = i, e, index = i;

                    if (input.charAt(j) === '~') { j++; e = true; } // Escaped strings
                    if (input.charAt(j) !== '"' && input.charAt(j) !== "'") { return; }

                    if (e) { $char('~'); }

                    str = $re(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
                    if (str) {
                        return new(tree.Quoted)(str[0], str[1] || str[2], e, index, env.currentFileInfo);
                    }
                }
322427
def escape(arg):
    "" 
    slash = '\\'
    special = '"$'

    arg = arg.replace(slash, slash+slash)
    for c in special:
        arg = arg.replace(c, slash+c)

    # print("ESCAPE RESULT: %s" % arg)
    return '"' + arg + '"'
523601
function escape(content) {
    return content.replace(/(["'\\])/g, '\\$1')
      .replace(/[\f]/g, "\\f")
      .replace(/[\b]/g, "\\b")
      .replace(/[\n]/g, "\\n")
      .replace(/[\t]/g, "\\t")
      .replace(/[\r]/g, "\\r");
  }
1026728
function tmpl(str, data) {
			return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
				return data[key] || '';
			});
		}
956083
function escapeCharacters(params) {
    return params;
    var find = new Array('.','-','%','/','\\\\',':','*','\\','<','>','|','?',' ','&','#');
    var replace = new Array('.0','.1','.2','.3','.4','.5','.6','.7','.8','.9','.a','.b','.c','.d','.e'); 
    var escaped = {};
    for (var param in params) {
        if(typeof(params[param]) == 'string') {
            escaped[param] = replaceCharacter(find, replace, params[param]);
        }
        else {
            escaped[param] = params[param];
        }
    }
    return escaped;
}
306328
def legacy_html_escape(s):
    """"""
    s = s.replace("&", "&amp;")
    s = s.replace(">", "&gt;")
    s = s.replace("<", "&lt;")
    s = s.replace('"', "&#34;")
    s = s.replace("'", "&#39;")
    return s
5349
function (directory, filename) {

        return Path.join(directory, filename).replace(/^[a-z]:\\/i, '/').replace(/\\/g, '/');

    }
822750
function (key) {
        let result = key.split('');
        if (key.indexOf('/') > -1) {
            while (result.indexOf('/') > -1) {
                result.splice(result.indexOf('/') + 1, 0, '[');
                result[result.indexOf('/')] = ']';
            }
            result.push(result.splice(result.indexOf(']'), 1));
        } else if (key.indexOf('[') > -1) {
            while (result.indexOf('[') > -1) {
                result[result.indexOf('[')] = '/';
                result.splice(result.indexOf(']'), 1);
            }
        }
        return result.join('');
    }
637464
function replaceLocKeys(str) {
      var reExtra = /el"(.*?)"/g;
      var result = str.replace(reExtra, function (m, key) {
        return '"' + tiaEJ.getLocaleValue(key, true) + '"';
      });
      var re = /l"(.*?)"/g;
      result = result.replace(re, function (m, key) {
        return '"' + tiaEJ.getLocaleValue(key) + '"';
      });

      result = result.replace(/,/g, '\\,');

      return result;
    }
557401
def escape(url):
    '''
    
    '''
    if salt.utils.platform.is_windows():
        return url

    scheme = urlparse(url).scheme
    if not scheme:
        if url.startswith('|'):
            return url
        else:
            return '|{0}'.format(url)
    elif scheme == 'salt':
        path, saltenv = parse(url)
        if path.startswith('|'):
            return create(path, saltenv)
        else:
            return create('|{0}'.format(path), saltenv)
    else:
        return url
35690
private static String replaceChars(String str)
  {
    StringBuffer buf = new StringBuffer(str);
    int length = buf.length();
    for (int i = 0; i < length; i++)
    {
      char currentChar = buf.charAt(i);
      // Replace space with "%20"
      if (currentChar == ' ')
      {
        buf.setCharAt(i, '%');
        buf.insert(i+1, "20");
        length = length + 2;
        i = i + 2;
      }
      // Replace backslash with forward slash
      else if (currentChar == '\\')
      {
        buf.setCharAt(i, '/');
      }
    }

    return buf.toString();
  }
445885
def quote(s, unsafe='/'):
    """"""
    res = s.replace('%', '%25')
    for c in unsafe:
        res = res.replace(c, '%' + (hex(ord(c)).upper())[2:])
    return res
183597
def escape(str):
    """"""
    out = ''
    for char in str:
        if char in '\\ ':
            out += '\\'
        out += char
    return out
691281
private String maybeAddTrailingSlash(String key) {
    if (!key.isEmpty() && !key.endsWith("/")) {
      return key + '/';
    } else {
      return key;
    }
  }
512906
private static String processQuotesAndSlashes(String start, char find, char replace_with)
    {
        String dataPut = "";
        int inEscape = 0;
        int inQuotes = 0;

        char[] startChars = start.toCharArray();
        for (char startChar : startChars)
        {
            if (inEscape != 0)
            {
                dataPut += startChar; /* Always goes verbatim */
                inEscape = 0;
            }
            else
            {
                if (startChar == '\\')
                {
                    inEscape = 1; /* Do not copy \ into the data */
                }
                else if (startChar == '\'')
                {
                    inQuotes = 1 - inQuotes; /* Do not copy ' into the data */
                }
                else
                {
                    /* Replace , with |, unless in quotes */
                    dataPut += inQuotes != 0 ? startChar : ((startChar == find) ? replace_with : startChar);
                }
            }
        }
        return dataPut;
    }