Strip surrounding single/double quotes
505004
function(match, esc) {
        if (/^(\n|\r\n|\r|\f)$/.test(esc)) { return ''; }
        var m = /^[0-9a-f]{1,6}/i.exec(esc);
        if (m) {
            var codePoint = parseInt(m[0], 16);
            if (String.fromCodePoint) {
                return String.fromCodePoint(codePoint);
            } else {
                // XXX No support for surrogates on old JavaScript engines.
                return String.fromCharCode(codePoint);
            }
        }
        return esc;
    }
1274050
def strip_indent(s, n) 
		i = 0
		while i < s.size && n>0
			c = s[i,1]
			if c == ' '
				n-=1;
			elsif c == "\t"
				n-=TabSize;
			else
				break
			end
			i+=1
		end
		s[i, s.size]
	end
1118492
def strip_indent(s, n)
      while n > 0
        case s[0, 1]
        when ' '
          n -= 1
        when "\t"
          n -= TAB_SIZE
        else
          break
        end
        s = s[1..-1]
      end

      MDLine.new(s)
    end
328666
def _strip(string, pattern):
    """"""
    m = re.compile(pattern).search(string)

    if m:
        return string[0:m.start()] + string[m.end():len(string)]
    else:
        return string
1066123
def strip_escape(string='', encoding="utf-8"):  # pylint: disable=redefined-outer-name
    
    matches = []
    try:
        if hasattr(string, "decode"):
            string = string.decode(encoding)
    except Exception: # pylint: disable=broad-except
        # Tried to decode something that is not decodeable in the specified encoding. Let's just
        # move on.
        pass
    try:
        for match in ansi_eng.finditer(string):
            matches.append(match)
    except TypeError as error:
        raise TypeError("Unable to strip escape characters from data {}: {}".format(
            string, error))
    matches.reverse()
    for match in matches:
        start = match.start()
        end = match.end()
        string = string[0:start] + string[end:]
    return string
1009940
def quoted(s):
    
    # strip any existing quotes
    s = s.strip(u'"')
    # don't add quotes for minus or leading space
    if s[0] in (u'-', u' '):
        return s
    if u' ' in s or u'/' in s:
        return u'"%s"' % s
    else:
        return s
445885
def quote(s, unsafe='/'):
    """"""
    res = s.replace('%', '%25')
    for c in unsafe:
        res = res.replace(c, '%' + (hex(ord(c)).upper())[2:])
    return res
484803
def strip_outer_tag(text):
    """"""
    if not text or not isinstance(text, basestring):
        return text
    stripped = text.strip()
    if (stripped.startswith('<p>') or stripped.startswith('<div>')) and \
        (stripped.endswith('</p>') or stripped.endswith('</div>')):
        return stripped[stripped.index('>')+1:stripped.rindex('<')]
    return text
654268
def mdstrip(value, length=None, end='…'):
    '''
    
    '''
    if not value:
        return ''
    if EXCERPT_TOKEN in value:
        value = value.split(EXCERPT_TOKEN, 1)[0]
    rendered = md(value, wrap=False)
    text = do_striptags(rendered)
    text = bleach_clean(text)
    if length and length > 0:
        text = do_truncate(None, text, length, end=end, leeway=2)
    return text
683809
def strip_linebreaks(s):
    
    return u"\n".join([c for c in s.split(u'\n') if c])
451324
private static function stripQuotes($value)
    {
        if (
            ($value[0] === '"' && substr($value, -1) === '"')
         || ($value[0] === "'" && substr($value, -1) === "'")
        ) {
            return substr($value, 1, -1);
        }

        return $value;
    }
1087996
def escape(s, quote=True):
    
    s = s.replace("&", "&amp;") # Must be done first!
    s = s.replace("<", "&lt;")
    s = s.replace(">", "&gt;")
    if quote:
        s = s.replace('"', "&quot;")
        s = s.replace('\'', "&#x27;")
    return s
299547
def _strip_invisible(s):
    ""
    if isinstance(s, _text_type):
        return re.sub(_invisible_codes, "", s)
    else:  # a bytestring
        return re.sub(_invisible_codes_bytes, "", s)
757037
def strip(self, data, strip_newlines=False):
        
        text = []
        for token_type, tag_name, tag_opts, token_text in self.tokenize(data):
            if token_type == self.TOKEN_DATA:
                text.append(token_text)
            elif token_type == self.TOKEN_NEWLINE and not strip_newlines:
                text.append(token_text)
        return ''.join(text)
1085578
def unescape(s, quote=False):
    
    s = s.replace('&lt;', '<')
    s = s.replace('&gt;', '>')
    if quote:
        s = s.replace('&quot;', '"')
    s = s.replace('&amp;', '&')
    return s
460425
def _apply_single(self, string):
        
        if string is None:
            return None
        result = self.regex.sub("", string)
        result = self.SPACES_REGEX.sub(" ", result).strip()
        return result
1253846
def strip_literal(literal)
      literal = literal[1..-1] if literal[0] == ':'
      literal = literal[1..-2] if literal[0] == "'" || literal[0] == '"'
      literal
    end