The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SPVM::Regex::Replacer - Regex::Replacer in SPVM | a callback interface for the regex replacement

SYNOPSYS

  use Regex::Replacer;
  
  my $replacer : Regex::Replacer = method : string ($re : Regex) {
    return "AB" . $re->captures->[0] . "C";
  });
  
  my $re = Regex->new("ab(c)");
  my $string_for_replace = $replacer->($re);

DESCRIPTION

Regex::Replacer is a callback interface for the regex replacement.

CALLBACK METHOD INTERFACE

  method : string ($re : Regex)

This method return the string after the replacement.

This method is planned to be implemented in other classes.