14:03 bbkr: star: use IETF::RFC_Grammar::URI; say so " " ~~ m/<IETF::RFC_Grammar::URI::TOP>/
14:03 p6eval: star 2012.05: OUTPUT«True␤»
14:04 jnthn: ...that doens't look like a URI to me :)
14:04 bbkr: indeed, creating GH issue now...
14:09 moritz: ah, and the space is never parsed, because the regex is not anchored
RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, has a section (4.2) on the "Relative Reference" which makes the empty string a valid relative reference, or URI of sorts, relative to a base URI. So relative to http://github.com both the empty string and '/foo.html' are valid relative references. I have chosen to make a relative reference a valid thing to parse as an URI. In response to this situation w3 (see http://www.w3.org/TR/2011/WD-html5-20110113/author/urls.html) has identified the concept of "a valid non-empty URL".
As discussed on IRC yesterday, http://irclog.perlgeek.de/perl6/2012-05-31#i_5662923, the URI module has a validating URI rule which somewhat addresses the initial complaint of treating " " as an URI. If you don't need relative references there is also a URI rule which should match http://gitub.com and ftp://rakudo.org.
You raised an objection that sometimes you are searching for URIs and matching the empty string doesn't really make sense. In response I propose to add a "valid non-empty URL(/URI)" rule which can be used for such searches.
Since there was no other comment on this matter I added a grammar rule TOP_non_empty to partially remedy bbkr's complaint. It seems to me that it is reasonable to add a search method to the URI module, which would also make it easy to add some tests. Note that this functionality goes beyond Perl 5 URI AFAIK. The additional step is a bit involved since I think it would also make sense for the search method to be lazy and fixing that may wait for another day. So some progress on this issue but leaving it open for now.
Resolution of this now depends on an open rakudo ticket https://rt.perl.org/rt3/Ticket/Display.html?id=112716