NAME

Data::Object::Replace

ABSTRACT

Data-Object Replace Class

SYNOPSIS

use Data::Object::Replace;

my $result = Data::Object::Replace->new([
  $regexp,
  $altered_string,
  $count,
  $last_match_end,
  $last_match_start,
  $named_captures,
  $initial_string
]);

DESCRIPTION

This package provides routines for introspecting the results of a regexp replace operation.

INHERITANCE

This package inherits behaviors from:

Data::Object::Array

LIBRARIES

This package uses type constraints defined by:

Data::Object::Library

METHODS

This package implements the following methods.

captures

captures() : ArrayObject

The captures method returns the capture groups from the result object which contains information about the results of the regular expression operation.

captures example
my $captures = $result->captures();

count

count() : NumObject

The count method returns the number of match occurrences from the result object which contains information about the results of the regular expression operation.

count example
my $count = $result->count();

initial

initial() : StrObject

The initial method returns the unaltered string from the result object which contains information about the results of the regular expression operation.

initial example
my $initial = $result->initial();

last_match_end

last() : Any

The last_match_end method returns an array of offset positions into the string where the capture(s) stopped matching from the result object which contains information about the results of the regular expression operation.

last_match_end example
my $last_match_end = $result->last_match_end();

last_match_start

last() : Any

The last_match_start method returns an array of offset positions into the string where the capture(s) matched from the result object which contains information about the results of the regular expression operation.

last_match_start example
my $last_match_start = $result->last_match_start();

matched

matched() : StrObject | UndefObject

The matched method returns the portion of the string that matched from the result object which contains information about the results of the regular expression operation.

matched example
my $matched = $result->matched();

named_captures

name() : StrObject

The named_captures method returns a hash containing the requested named regular expressions and captured string pairs from the result object which contains information about the results of the regular expression operation.

named_captures example
my $named_captures = $result->named_captures();

postmatched

postmatched() : StrObject | UndefObject

The postmatched method returns the portion of the string after the regular expression matched from the result object which contains information about the results of the regular expression operation.

postmatched example
my $postmatched = $result->postmatched();

prematched

prematched() : StrObject | UndefObject

The prematched method returns the portion of the string before the regular expression matched from the result object which contains information about the results of the regular expression operation.

prematched example
my $prematched = $result->prematched();

regexp

regexp() : RegexpObject

The regexp method returns the regular expression used to perform the match from the result object which contains information about the results of the regular expression operation.

regexp example
my $regexp = $result->regexp();

string

string() : StrObject

The string method returns the string matched against the regular expression from the result object which contains information about the results of the regular expression operation.

string example
my $string = $result->string();

CREDITS

Al Newkirk, +319

Anthony Brummett, +10

Adam Hopkins, +2

José Joaquín Atria, +1

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated here, https://github.com/iamalnewkirk/do/blob/master/LICENSE.

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues

SEE ALSO

To get the most out of this distribution, consider reading the following:

Do

Data::Object

Data::Object::Class

Data::Object::ClassHas

Data::Object::Role

Data::Object::RoleHas

Data::Object::Library