Find URI in text: Difference between revisions

Content added Content deleted
(Added Kotlin)
(→‎{{header|Perl 6}}: Update to current code)
Line 336: Line 336:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
This needs an installed URI distribution. {{works with|Rakudo}}
This needs an installed URI distribution. {{works with|Rakudo|2018.03}}
<lang perl6>use v6;
<lang perl6>use v6;
use IETF::RFC_Grammar::URI;
use IETF::RFC_Grammar::URI;


say q:to/EOF/.match(/ <IETF::RFC_Grammar::URI::absolute_URI> /, :g).list.join("\n");
say q:to/EOF/.match(/ <IETF::RFC_Grammar::URI::absolute-URI> /, :g).list.join("\n");
this URI contains an illegal character, parentheses and a misplaced full stop:
this URI contains an illegal character, parentheses and a misplaced full stop:
http://en.wikipedia.org/wiki/Erich_Kästner_(camera_designer). (which is handled by http://mediawiki.org/).
http://en.wikipedia.org/wiki/Erich_Kästner_(camera_designer). (which is handled by http://mediawiki.org/).
Line 352: Line 352:
EOF
EOF


say $/;
say $/[*-1];
say "We matched $/, which is a $/.^name() at position $/.from() to $/.to()"
say "We matched $/[*-1], which is a $/[*-1].^name() at position $/[*-1].from() to $/[*-1].to()"
</lang>
</lang>