ECMA262Regex validation, parsing, and compilation
Branch: master
Clone or download
Latest commit 4dd66c0 Sep 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Decrement backreference digit in Perl 6 regex Sep 28, 2018
t Decrement backreference digit in Perl 6 regex Sep 28, 2018
.gitignore Initial commit Sep 17, 2018
META6.json Fix invalid json Sep 29, 2018
README.md

README.md

ECMA262Regex

This module allows you parsing ECMA262 regex notation and use it in Perl 6.

SYNOPSIS

use v6;
use ECMA262Regex;

say ECMA262Regex.validate('\e'); # False;
say ECMA262Regex.validate('^fo+\n'); # True

# Translate regex into Perl 6 one (string form)
say ECMA262Regex.as-perl6('^fo+\n'); # '^fo+\n'
say ECMA262Regex.as-perl6('[^ab-d]'); # '<-[ab..d]>'

# Compile textual ECMA262 regex into Perl 6 Regex object
my $regex = ECMA262Regex.compile('^fo+\n');

say "foo\n"  ~~ $regex; # Success
say " foo\n" ~~ $regex; # Failure