Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9b7063c126
Fetching contributors…

Cannot retrieve contributors at this time

executable file 20 lines (15 sloc) 0.561 kb
#!/usr/bin/alpha
use v6;
use GGE;
die "Usage: ./test-regex <pattern> <target>"
unless @*ARGS == 2;
my ($pattern, $target) = @*ARGS;
my GGE::Match $match
= GGE::Perl6Regex.new($pattern, :debug)\
.( backslash_escape($target), :debug );
say $match ?? $match.dump_str('mob', ' ', '') !! "No match\n";
sub backslash_escape($string) {
return $string.trans(['\n', '\r', '\e', '\t', '\f'] =>
["\n", "\r", "\e", "\t", "\f"])\
.subst(/'\\x' (<[0..9a..f]>**{4})/, { chr(:16($0)) }, :g);
}
Jump to Line
Something went wrong with that request. Please try again.