# 24428 lines total # grep -r '@include' * | perl -nle 'if (m/.*?\@include\s+(\S+).*/) { print "$1" }' | wc -l if pattern is * # 926 lines output is http://*/* and https://*/* end if pattern starts with "file:?/?/?" # only 39, but eliminates this case # the remaining special schemes are incredibly rare, and basically all bugs output is "file://" + remainder end if pattern starts with "(https?)(:?/?/?)": # 18890 scheme is $1 remove any $2 strip scheme from pattern else: # it probably starts with "*" # 4469 schemes are 'http' and 'https' if pattern is '*': output is ://*/* end if now starts with *.? match_subdomains = true strip *.? # 23171 lines left look for '/' if there is one: host is everything to the left path is everything to the right if host ends with .?* or .tld: # 5618 replace .?* or .tld with .com else: if pattern doesn't end in .?*: # 382 error if domain component before .?* is a registry-controlled suffix or .tld: replace registry controlled suffix with '.com' host ends at .com path is * else: host ends before .?* path is * if host still contains '*': give up