SPVM::Regex::ReplaceInfo - Regex Replacement Information
The Regex::ReplaceInfo class of SPVM has methods to manipulate a regex replacement information.
use Regex::ReplaceInfo; my $replace_info = Regex::ReplaceInfo->new({replaced_count => 3, match => $match}); my $replaced_count = $replace_info->replaced_count; my $match = $replace_info->match; my $cap1 = $match->cap1; my $cap2 = $match->cap2; my $cpa3 = $match->cap3;
has replaced_count : ro int;
Gets the replaced_count field.
replaced_count
This field is set to the number of strings replaced the replace and replace_g method in the Regex class.
has match : ro Regex::Match;
Gets the match field. The type is Regex::Match.
match
This field is set to the result of the pattern match performed by the the replace and replace_g method in the Regex class.
static method new : Regex::ReplaceInfo ($options = undef : object[]);
Creates a new Regex::ReplaceInfo object.
Options:
The options are key-value pairs. Each key must be a string type. Otherwise an exception is thrown.
If an unsupported option is specified, an exception is thrown.
Sets the "replaced_count" field.
The value must be cast to the int type. Otherwise an exception is thrown.
int
Default:
0
Sets the "match" field.
The value must be a Regex::Match object or undef. Otherwise an exception is thrown.
undef
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.