Regexp::Melody - Melody is a language that compiles to regular expressions, while aiming to be more readable and maintainable
version 0.001000
use Test2::V0; use Regexp::Melody; my $re = Regexp::Melody->new( <<'MELODY' ); 16 of "na"; 2 of match { <space>; "batman"; } MELODY like( "nananananananananananananananana batman", $re ); done_testing;
Melody is a more verbose way of writing regular expressions.
Melody syntax is described at https://yoav-lavi.github.io/melody/book/.
This module is a wrapper around the Rust implementation of Melody, and provides a functional interface identical to the Rust library, as well as an object-oriented interface which may be more convenient for use in Perl.
No functions are exported by default, but they may be requested:
use Regexp::Melody qw( compiler );
compiler( $melody )
Compiles the string of Melody into a PCRE-like string.
new( $melody )
Compiles a string of Melody into a regular expression.
The returned object is a blessed Perl object, but may be used on the right hand side of the `=~` operator like a regexp.
(It's actually a blessed regexp ref, but that detail may change in future versions of this module.)
to_melody()
Turns the regexp back into a string of Melody.
Please report any bugs to https://github.com/tobyink/p5-regexp-melody/issues.
https://crates.io/crates/melody_compiler.
https://yoav-lavi.github.io/melody/book/.
Author: Toby Inkster
Contributors:
Yoav Lavi (Rust library)
This software is copyright (c) 2023 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Regexp::Melody, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Regexp::Melody
CPAN shell
perl -MCPAN -e shell install Regexp::Melody
For more information on module installation, please visit the detailed CPAN module installation guide.