Data::Object::Regexp
Data-Object Regexp Class
use Data::Object::Regexp; my $re = Data::Object::Regexp->new(qr(\w+));
Data::Object::Regexp provides routines for operating on Perl 5 regular expressions. Data::Object::Regexp methods work on data that meets the criteria for being a regular expression.
This package implements the following methods.
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.
# given $regexp $regexp->defined; # 1
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.
# given qr(test) $re->replace('this is a test', 'drill'); $re->replace('test 1 test 2 test 3', 'drill', 'gi');
roles() : ArrayRef
The roles method returns the list of roles attached to object. This method returns a Data::Object::Array object.
# given $regexp $regexp->roles;
rules() : ArrayRef
The rules method returns consumed rules.
my $rules = $regexp->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.
# given qr((test)) $re->search('this is a test'); $re->search('this does not match', 'gi');
This package inherits all behavior from the folowing role(s):
Data::Object::Role::Detract
Data::Object::Role::Dumper
Data::Object::Role::Output
Data::Object::Role::Throwable
This package adheres to the requirements in the folowing rule(s):
Data::Object::Rule::Defined
To install Data::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Object
CPAN shell
perl -MCPAN -e shell install Data::Object
For more information on module installation, please visit the detailed CPAN module installation guide.