NAME

Data::Object::Regexp

ABSTRACT

Data-Object Regexp Class

SYNOPSIS

use Data::Object::Regexp;

my $re = Data::Object::Regexp->new(qr(\w+));

DESCRIPTION

This package provides routines for operating on Perl 5 regular expressions.

METHODS

This package implements the following methods.

defined

defined() : NumObject

The defined method returns true if the object represents a value that meets the criteria for being defined, otherwise it returns false. This method returns a Data::Object::Number object.

defined example
# given $regexp

$re->defined; # 1

replace

replace(Str $arg1, Str $arg2) : StrObject

The replace method performs a regular expression substitution on the given string. The first argument is the string to match against. The second argument is the replacement string. The optional third argument might be a string representing flags to append to the s///x operator, such as 'g' or 'e'. This method will always return a Data::Object::Replace object which can be used to introspect the result of the operation.

replace example
# given qr(test)

$re->replace('this is a test', 'drill');
$re->replace('test 1 test 2 test 3', 'drill', 'gi');

roles

roles() : ArrayRef

The roles method returns the list of roles attached to object. This method returns a Data::Object::Array object.

roles example
# given $regexp

$re->roles;

rules

rules() : ArrayRef

The rules method returns consumed rules.

rules example
my $rules = $re->rules;
search(Str $arg1) : SearchObject

The search method performs a regular expression match against the given string This method will always return a Data::Object::Search object which can be used to introspect the result of the operation.

search example
# given qr((test))

$re->search('this is a test');
$re->search('this does not match', 'gi');

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 same terms as the Perl 5 programming language system itself.

STATUS

SEE ALSO

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

Data::Object::Class

Data::Object::Role

Data::Object::Rule

Data::Object::Library

Data::Object::Signatures

Contributing

GitHub