If an URL from a CSS url value contains start/end quotes, remove them.
This is not done in the regexp, since my regexp fu is not that strong,
and the CSS spec allows for ' and " in the URL if they are backslash escaped.
@param {String} url
517089
function cleanCssUrlQuotes(url) {
        //Make sure we are not ending in whitespace.
        //Not very confident of the css regexps above that there will not be ending
        //whitespace.
        url = url.replace(/\s+$/, "");

        if (url.charAt(0) === "'" || url.charAt(0) === "\"") {
            url = url.substring(1, url.length - 1);
        }

        return url;
    }
396323
function( url ) {
			var parts = this.path.split('/'),
				other_parts = url.split('/'),
				result = '';
			while ( parts.length > 0 && other_parts.length > 0 && parts[0] == other_parts[0] ) {
				parts.shift();
				other_parts.shift();
			}
			each(other_parts, function(){ result += '../'; })
			return result + parts.join('/');
		}
300988
function (url) {
            return url
                .replace(/[\/]+/g, '/')
                .replace(/\/\?/g, '?')
                .replace(/\/\#/g, '#')
                .replace(/\:\//g, '://');
        }
2840
private String extractPathFromUrl(String url) {
        String path = url.replaceAll(".+://.+?(?=/)", "");
        if (!path.startsWith("/")) {
            throw new RuntimeException("Path must start with '/': " + path);
        }
        return path;
    }
599263
protected boolean excluded(String url) {
        for (final Pattern urlPattern : this.excludedUrls) {
            final Matcher matcher = urlPattern.matcher(url);
            if (matcher.matches()) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Exclude pattern " + urlPattern.pattern() + " matches " + url);
                }
                return true;
            }
        }
        
        return false;
    }
63270
CssFormatter append( String str ) {
        if( inlineMode ) {
            str = UrlUtils.removeQuote( str );
        }
        output.append( str );
        return this;
    }
1279707
def is_escaped(url):
    '''
    
    '''
    scheme = urlparse(url).scheme
    if not scheme:
        return url.startswith('|')
    elif scheme == 'salt':
        path, saltenv = parse(url)
        if salt.utils.platform.is_windows() and '|' in url:
            return path.startswith('_')
        else:
            return path.startswith('|')
    else:
        return False
267516
function formatParamUrl (url) {
  var start = url.indexOf('/:')
  if (start === -1) return url

  var end = url.indexOf('/', ++start)

  if (end === -1) {
    return url.slice(0, start) + '{' + url.slice(++start) + '}'
  } else {
    return formatParamUrl(url.slice(0, start) + '{' + url.slice(++start, end) + '}' + url.slice(end))
  }
}
391969
function correctHttpAndHttps(url) {
	var baseURL = url;

	// Check if http:// is correct
	if (new RegExp('^http://').test(baseURL)) {
		// Do nothing

	} else {
		// Check if https:// is correct
		if (new RegExp('^https://').test(baseURL)) {
			// Do nothing

		} else {
			// http:// or https:// is not set correct

			// Replace protocol mistakes like 'ttp://' to 'http://'
			var testHttp01 = new RegExp('^ttp://');
			if (testHttp01.test(baseURL)) {
				baseURL = baseURL.replace(testHttp01, 'http://')
			} else {
				var testHttp02 = new RegExp('^tp://');
				if (testHttp02.test(baseURL)) {
					baseURL = baseURL.replace(testHttp02, 'http://')
				} else {
					var testHttp03 = new RegExp('^p://');
					if (testHttp03.test(baseURL)) {
						baseURL = baseURL.replace(testHttp03, 'http://')
					} else {
						var testHttp04 = new RegExp('^://');
						if (testHttp04.test(baseURL)) {
							baseURL = baseURL.replace(testHttp04, 'http://')
						} else {
							var testHttp05 = new RegExp('^//');
							if (testHttp05.test(baseURL)) {
								baseURL = baseURL.replace(testHttp05, 'http://')
							} else {
								var testHttp06 = new RegExp('^/');
								if (testHttp06.test(baseURL)) {
									baseURL = baseURL.replace(testHttp06, 'http://')
								} else {
									var testHttps01 = new RegExp('^ttps://');
									if (testHttps01.test(baseURL)) {
										baseURL = baseURL.replace(testHttps01, 'https://')
									} else {
										var testHttps02 = new RegExp('^tps://');
										if (testHttps02.test(baseURL)) {
											baseURL = baseURL.replace(testHttps02, 'https://')
										} else {
											var testHttps03 = new RegExp('^ps://');
											if (testHttps03.test(baseURL)) {
												baseURL = baseURL.replace(testHttps03, 'https://')
											} else {
												var testHttps04 = new RegExp('^s://');
												if (testHttps04.test(baseURL)) {
													baseURL = baseURL.replace(testHttps04, 'https://')
												} else {
													var testHttp07 = new RegExp('^.');
													if (testHttp07.test(baseURL)) {
														baseURL = 'http://' + baseURL;
													} else {
														// Other mistakes
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

	return baseURL;
}
846055
def remove_slashes(url)
      return url unless url.present? && url.include?('//')
      parts = url.split('//')
      return parts[0..1].join if parts.length > 2
      url
    end
948886
def validate_url(cls, url):
        

        if url is None:
            return None

        url = url.strip()
        while url.endswith('/'):
            url = url[:-1]
        return url
903238
function shortenUrl ( url , length ) {

  if( !isBlank( url ) && url.length > length) {
      url = url.substr( 0 , length ) + "...";
  }

  return url;
}
623756
function stripTrailingSlash(url) {
        var arr = url.split('/');
        if (arr[arr.length - 1] === '') {
            arr.pop();
        }
        return arr.join('/');
    }
599282
private String removePathFromUrl(String url) {
        String path = extractPathFromUrl(url);
        int end = url.indexOf(path);
        return url.substring(0, end);

        // Alternative: return url.replaceAll("(?<=:[0-9]{1,5})/.*", "")), assume url contains port number
    }
304289
function trimUrlQuery(url: string): string {
  const length = url.length;
  const q1 = url.indexOf("?");
  const q2 = url.indexOf("&");
  const q3 = url.indexOf("#");
  const q = Math.min(
    q1 != -1 ? q1 : length,
    q2 != -1 ? q2 : length,
    q3 != -1 ? q3 : length
  );

  return url.slice(0, q);
}
1158550
function(value, text) {
      // escape regex characters
      text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
      return (value.search( new RegExp(text, 'i') ) !== -1);
    }
92664
function sanitizeStyle(value) {
	        value = String(value).trim(); // Make sure it's actually a string.
	        if (!value)
	            return '';
	        // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
	        // reasoning behind this.
	        var urlMatch = value.match(URL_RE);
	        if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
	            value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
	            return value; // Safe style values.
	        }
	        if (_angular_core.isDevMode()) {
	            getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
	        }
	        return 'unsafe';
	    }