The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Object::Regexp

ABSTRACT

Data-Object Regexp Class

SYNOPSIS

  use Data::Object::Regexp;

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

DESCRIPTION

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.

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

  $regexp->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

  $regexp->roles;

rules

  rules() : ArrayRef

The rules method returns consumed rules.

rules example
  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.

search example
  # given qr((test))

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

ROLES

This package inherits all behavior from the folowing role(s):

RULES

This package adheres to the requirements in the folowing rule(s):