PCRE flavor, 261 289 210 184 127 109 71 53 51 44 40 bytes Yes, it is possible! <^<()(?R){2}>\z|\1\Q^<()(?R){2}>\z|\1\Q> Try it here. (But / is shown to be the delimiter on Regex101.) Please refrain from making unnecessary edits (updates) on the Regex101 page. If your edit doesn't actually involve improving, trying or testing this regex, ...


Wolfram This feels like complete cheating Import["http://www.stroustrup.com/C++.html", "Hyperlinks"] So just add some honest parsing on top Cases[ Import["http://www.stroustrup.com/C++.html", "XMLObject"], XMLElement["a", {___, "href" -> link_, ___}, ___] :> link /; StringMatchQ[link, RegularExpression["((http://)?www([./#\\+-]\\w*)+)"]] , ...


C++ #include <boost/asio.hpp> #include <regex> #include <iostream> int main() { std::string server = "www.stroustrup.com"; std::string request = "GET http://" + server + "/C++.html HTTP/1.0\r\nHost: " + server + "\r\n\r\n"; boost::asio::ip::tcp::iostream s{server, "http"}; s << request; std::regex pat{R"((http://)?...


Pure Bash on Linux/OS X (no external utilities) HTTP client software is notoriously bloated. We don't want those kinds of dependencies. Instead we can push the appropriate headers down a TCP stream and read the result. No need to call archaic utilities like grep or sed to parse the result. domain="www.stroustrup.com" path="C++.html" ...


Python 2 import urllib2 as u, re s = "http://www.stroustrup.com/C++.html" w = u.urlopen(s) h = w.read() l = re.findall('"((http)s?://.*?)"', h) print l Lame, but works


6 chars Following on the answers of primo and Peter Taylor, and a hint from man perlre: /(?!)/ This perl-compatible regex matches an empty string which is not followed by another empty string.


C# using System; using System.Net; using System.Text.RegularExpressions; class Program { static void Main() { string html = new WebClient().DownloadString("http://www.stroustrup.com/C++.html"); foreach (Match match in Regex.Matches(html, @"https?://[^""]+")) Console.WriteLine(match); } }


"No third-party" is a fallacy I think the "no third-party" assumption is a fallacy. And is a specific fallacy that afflicts C++ developers, since it's so hard to make reusable code in C++. When you are developing anything at all, even if it's a small script, you will always make use of whatever pieces of reusable code are available to you. The thing is, ...


UNIX shell lynx -dump http://www.stroustrup.com/C++.html | grep -o '\w*://.*' Also finds an ftp:// link :) Another way, without relying on :// syntax: lynx -dump -listonly http://www.stroustrup.com/C++.html | sed -n 's/^[ 0-9.]\+//p'


PCRE .NET, 35 32 bytes -3 bytes thanks to Martin Ender Rock: ([*?]$) Paper: [)$]$+ Scissors: [+?]$.* Lizard: [+$]$.? Spock: [*)]$ The idea here is to match characters at the end of other regexes which are reserved regex characters, but stop being treated as such when inside a character class.


PCRE, 15 14 bytes Rock: B Paper: \b$ Scissors: b|B. Lizard: \B. Spock: ^\w


CSS 3 * { margin: 0; padding: 0; } *:not(a) { font: 0/0 monospace; color: transparent; background: transparent !important; } a { content: ""; } a[href*="://"]::after { content: attr(href); float: left; clear: left; display: block; font: 12px monospace; color: black; } This code can be used as a user style to display only absolute ...


8 chars /(?=a)b/ We require a string containing a character which is both a and b, which is obviously impossible.


Ruby regex, 71 78 73 bytes ^(?!.*(?=(.))(.{9}+|(.(?!.{9}*$))+|(?>.(?!.{3}*$)|(.(?!.{27}*$)){7})+)\1) I don't really know Ruby but apparently it doesn't complain about cascaded quantifiers. Try it here. .NET regex, 79 78 75 or 77 bytes Because Martin thinks this is possible... But I guess he will just incorporate these changes too. ^(?!(.)+((.{9})+|(?>(...


no fancy features, 35 30 bytes 5 bytes saved by Neil's idea which uses that ] needs no \. This works for example with the python re module. R='[SLR]]' P='[RVP]]' S='[PLS]]' L='[PVL]]' V='[SRV]]' It searches for a ] preceded by a letter that indicates which rule it is. Previous version used R='\[[RSL]' etc. An earlier attempt with score 40 was using R='[...


Clojure (->> (slurp "http://www.stroustrup.com") (re-seq #"(?:http://)?www(?:[./#\+-]\w*)+"))


.NET regex, 119 118 105 bytes ^(?>(?=[1468](?<4>)|)(?=[2569](?<4>){2}|)([3-6]()|\d)((?<-2>)(){3}|){7}((?<-4>){7}|(?<2-4>)|){9})+$(?!\2) 111 characters disallowing initial 0s: ^(?!0.)(?>(?=[1468](?<4>)|)(?=[2569](?<4>){2}|)([3-6]()|\d)((?<-2>)(){3}|){7}((?<-4>){7}|(?<2-4>)|){9})+$(?!\2) 113 ...


PCRE, 117 119 130 133 147 bytes ^(?!(.{27})*(...){0,2}(.{9})?.?.?(.).?.?(?=(?2)*$).{6,8}(?3)?\4.{0,17}(?1)*$|.*(.)(.{8}(?3)*|((?!(?3)*$)(|.(?7))))\5) Should also work in Python, Java, etc. flavors. Now with recursion! And the "recursion" feature used non-recursively for "subroutines", which I totally forgot about until I had to use actual recursion.


5 chars Unlike everybody who abuses $ and ^... this actually works in Perl: /V\A/ \A matches the beginning of the string.


.NET flavor, score:2 Regex Modifiers Replacement Repeat? <empty> <none> 9876543210 No <see below> x <empty> No I'm not bothered to golf it yet, and x is just for ignoring whitespaces. It firstly insert 9876543210 at each position, then delete the original characters and the characters those are not ...


Emacs Lisp (with-current-buffer (url-retrieve-synchronously "http://www.stroustrup.com/C++.html") (while (re-search-forward "https?://[^\\\"]*") (print (match-string 0))))


6 chars /x\by/ Based on Sven Hohenstein's answer.


8 characters /\w\b\w/ A word boundary (\b) surrounded by 'word' characters (\w - one of [_a-zA-Z0-9]). It is unmatchable since one of the characters preceding or following a word boundary must be a non-'word' character. By the way: this is similar to the unmatchable expression /\W\b\W/ where \W means non-'word' character.


Basic Regex, 656813 bytes [safe!] The regex to end all regexes. One final hurrah into the night. Testable under PCRE, Perl, Python and many others. bzip2'd and base64-encoded version on Pastebin: http://pastebin.com/9kprSWBn (Pastebin didn't want the raw version because it was too big). To make sure you get the right regex, you can verify that its MD5 hash ...


Scala """\"(https?://.*?)\"""".r.findAllIn(scala.io.Source.fromURL("http://www.stroustrup.com/C++.html").mkString).foreach(println)


PCRE, 20 19 Rock W Paper ^\w Scissors ^\W Spock w?\x57$ Lizard [w]W?


10791 characters, leading zeros allowed (0|7|46*[29]|(1|8|46*3|(2|9|46*4)(3|56*4)*(2|9|56*3))(5|[18]6*3|(6|[18]6*4)(3|56*4)*(2|9|56*3))*(4|63*[18]|(1|8|63*5)(6|43*5)*(2|9|43*[18]))|(2|9|46*4)(3|56*4)*(1|8|56*[29])|(3|46*5|(1|8|46*3|(2|9|46*4)(3|56*4)*(2|9|56*3))(5|[18]6*3|(6|[18]6*4)(3|56*4)*(2|9|56*3))*(0|7|63*4|(1|8|63*5)(6|43*5)*(5|43*4))|(2|9|46*4)(3|56*...


PHP 5 <?php preg_match_all('/"(https?:\/\/.*?)"/',file_get_contents('http://www.stroustrup.com/C++.html'),$m); print_r($m[1]);


Another Solution This is, in my opinion, one of the most interesting problems on the site. I need to thank deadcode for bumping it back up to the top. ^((^|xx)(^|\3\4\4)(^|\4x{12})(^x|\1))*$ 39 bytes, without any conditionals or assertions... sort of. The alternations, as they're being used (^|), are a type of conditional in a way, to select between "...


PowerShell Text search for all fully-qualified URLs (including JavaScript, CSS, etc.): [string[]][regex]::Matches((iwr "http://www.stroustrup.com/C++.html"), '\w+://[^"]+') Or to get links in anchor tags only (includes relative URLs): (iwr "http://www.stroustrup.com/C++.html").Links | %{ $_.href } Shorter versions from comments: (iwr "http://www....

Only top voted, non community-wiki answers of a minimum length are eligible