SPVM::Regex::Replacer - Interface for Regex Replacement Callback
The Regex::Replacer interface of SPVM has an interface method for the regex replacement callback.
use Regex::Replacer; use Regex; my $replacer = (Regex::Replacer)method : string ($re : Regex, $match : Regex::Match) { my $replace = "AB" . $match->cap1 . "C"; return $replace; }); my $string = "abc"; my $re = Regex->new("ab(c)"); my $replaced_string = $re->replace_g($string, $replacer);
required method : string ($re : Regex, $match : Regex::Match = undef);
Receives a Regex object and a Regex::Match object, and returns a replacement string.
The $match argument will be required in the future release.
Copyright (c) 2023 Yuki Kimoto
MIT License
To install SPVM::Regex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM::Regex
CPAN shell
perl -MCPAN -e shell install SPVM::Regex
For more information on module installation, please visit the detailed CPAN module installation guide.