Venus::Regexp

Regexp Class

Regexp Class for Perl 5

method: cast method: default method: eq method: ge method: gele method: gt method: gtlt method: le method: lt method: ne method: new method: numified method: replace method: search method: stringified method: tv

package main;

use Venus::Regexp;

my $regexp = Venus::Regexp->new(
  qr/(?<greet>\w+) (?<username>\w+)/u,
);

# $regexp->search;

This package provides methods for manipulating regexp data.

Venus::Kind::Value

The cast method converts "value" objects between different "value" object types, based on the name of the type provided. This method will return undef if the invocant is not a Venus::Kind::Value.

cast(string $kind) (object | undef)

{ since => '0.08', }

=example-1 cast

package main;

use Venus::Regexp;

my $regexp = Venus::Regexp->new;

my $cast = $regexp->cast('array');

# bless({ value => [qr/(?^u:)/] }, "Venus::Array")

The default method returns the default value, i.e. qr//.

default() (regexp)

{ since => '0.01', }

=example-1 default

# given: synopsis;

my $default = $regexp->default;

# qr/(?^u:)/

The eq method performs an "equals" operation using the argument provided.

eq(any $arg) (boolean)

{ since => '0.08', }

=example-1 eq

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->eq($rvalue);

# 0

The ge method performs a "greater-than-or-equal-to" operation using the argument provided.

ge(any $arg) (boolean)

{ since => '0.08', }

=example-1 ge

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->ge($rvalue);

# 1

The gele method performs a "greater-than-or-equal-to" operation on the 1st argument, and "lesser-than-or-equal-to" operation on the 2nd argument.

gele(any $arg1, any $arg2) (boolean)

{ since => '0.08', }

=example-1 gele

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->gele($rvalue);

# 0

The gt method performs a "greater-than" operation using the argument provided.

gt(any $arg) (boolean)

{ since => '0.08', }

=example-1 gt

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->gt($rvalue);

# 1

The gtlt method performs a "greater-than" operation on the 1st argument, and "lesser-than" operation on the 2nd argument.

gtlt(any $arg1, any $arg2) (boolean)

{ since => '0.08', }

=example-1 gtlt

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->gtlt($rvalue);

# 0

The le method performs a "lesser-than-or-equal-to" operation using the argument provided.

le(any $arg) (boolean)

{ since => '0.08', }

=example-1 le

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->le($rvalue);

# 0

The lt method performs a "lesser-than" operation using the argument provided.

lt(any $arg) (boolean)

{ since => '0.08', }

=example-1 lt

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->lt($rvalue);

# 0

The ne method performs a "not-equal-to" operation using the argument provided.

ne(any $arg) (boolean)

{ since => '0.08', }

=example-1 ne

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->ne($rvalue);

# 1

The new method constructs an instance of the package.

new(any @args) (Venus::Regexp)

{ since => '4.15', }

The numified method returns the numerical representation of the object. For regexp objects the method returns the length (or character count) of the stringified object.

numified() (number)

{ since => '0.08', }

=example-1 numified

# given: synopsis;

my $numified = $regexp->numified;

# 36

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 Venus::Replace object which can be used to introspect the result of the operation.

replace(string $string, string $substr, string $flags) (Venus::Replace)

{ since => '0.01', }

=example-1 replace

package main;

use Venus::Regexp;

my $regexp = Venus::Regexp->new(
  qr/(?<username>\w+)$/,
);

my $replace = $regexp->replace('Hey, unknown', 'awncorp');

# bless({ ... }, 'Venus::Replace')

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

search(string $string) (Venus::Search)

{ since => '0.01', }

=example-1 search

package main;

use Venus::Regexp;

my $regexp = Venus::Regexp->new(
  qr/(?<greet>\w+), (?<username>\w+)/,
);

my $search = $regexp->search('hey, awncorp');

# bless({ ... }, 'Venus::Search')

The stringified method returns the object, stringified (i.e. a dump of the object's value).

stringified() (string)

{ since => '0.08', }

=example-1 stringified

# given: synopsis;

my $stringified = $regexp->stringified;

# qr/(?<greet>\w+) (?<username>\w+)/u

The tv method performs a "type-and-value-equal-to" operation using argument provided.

tv(any $arg) (boolean)

{ since => '0.08', }

=example-1 tv

package main;

use Venus::Array;
use Venus::Regexp;

my $lvalue = Venus::Regexp->new;
my $rvalue = Venus::Array->new;

my $result = $lvalue->tv($rvalue);

# 0

This package overloads the eq operator.

This package overloads the ne operator.

This package overloads the qr operator.

t/Venus.t: present: authors t/Venus.t: present: license

148 POD Errors

The following errors were encountered while parsing the POD:

Around line 14:

Unknown directive: =name

Around line 22:

Unknown directive: =tagline

Around line 30:

Unknown directive: =abstract

Around line 38:

Unknown directive: =includes

Around line 61:

Unknown directive: =synopsis

Around line 82:

Unknown directive: =description

Around line 90:

Unknown directive: =inherits

Around line 98:

Unknown directive: =method

Around line 104:

Unknown directive: =signature

Around line 108:

Unknown directive: =metadata

Around line 150:

=cut found outside a pod block. Skipping to next block.

Around line 174:

=cut found outside a pod block. Skipping to next block.

Around line 198:

=cut found outside a pod block. Skipping to next block.

Around line 222:

=cut found outside a pod block. Skipping to next block.

Around line 246:

=cut found outside a pod block. Skipping to next block.

Around line 270:

=cut found outside a pod block. Skipping to next block.

Around line 294:

=cut found outside a pod block. Skipping to next block.

Around line 318:

=cut found outside a pod block. Skipping to next block.

Around line 342:

=cut found outside a pod block. Skipping to next block.

Around line 353:

Unknown directive: =method

Around line 357:

Unknown directive: =signature

Around line 361:

Unknown directive: =metadata

Around line 385:

Unknown directive: =method

Around line 389:

Unknown directive: =signature

Around line 393:

Unknown directive: =metadata

Around line 437:

=cut found outside a pod block. Skipping to next block.

Around line 461:

=cut found outside a pod block. Skipping to next block.

Around line 485:

=cut found outside a pod block. Skipping to next block.

Around line 509:

=cut found outside a pod block. Skipping to next block.

Around line 532:

=cut found outside a pod block. Skipping to next block.

Around line 556:

=cut found outside a pod block. Skipping to next block.

Around line 580:

=cut found outside a pod block. Skipping to next block.

Around line 604:

=cut found outside a pod block. Skipping to next block.

Around line 614:

Unknown directive: =method

Around line 619:

Unknown directive: =signature

Around line 623:

Unknown directive: =metadata

Around line 667:

=cut found outside a pod block. Skipping to next block.

Around line 691:

=cut found outside a pod block. Skipping to next block.

Around line 715:

=cut found outside a pod block. Skipping to next block.

Around line 739:

=cut found outside a pod block. Skipping to next block.

Around line 762:

=cut found outside a pod block. Skipping to next block.

Around line 786:

=cut found outside a pod block. Skipping to next block.

Around line 810:

=cut found outside a pod block. Skipping to next block.

Around line 834:

=cut found outside a pod block. Skipping to next block.

Around line 844:

Unknown directive: =method

Around line 849:

Unknown directive: =signature

Around line 853:

Unknown directive: =metadata

Around line 897:

=cut found outside a pod block. Skipping to next block.

Around line 921:

=cut found outside a pod block. Skipping to next block.

Around line 945:

=cut found outside a pod block. Skipping to next block.

Around line 969:

=cut found outside a pod block. Skipping to next block.

Around line 992:

=cut found outside a pod block. Skipping to next block.

Around line 1016:

=cut found outside a pod block. Skipping to next block.

Around line 1040:

=cut found outside a pod block. Skipping to next block.

Around line 1064:

=cut found outside a pod block. Skipping to next block.

Around line 1074:

Unknown directive: =method

Around line 1078:

Unknown directive: =signature

Around line 1082:

Unknown directive: =metadata

Around line 1126:

=cut found outside a pod block. Skipping to next block.

Around line 1150:

=cut found outside a pod block. Skipping to next block.

Around line 1174:

=cut found outside a pod block. Skipping to next block.

Around line 1198:

=cut found outside a pod block. Skipping to next block.

Around line 1221:

=cut found outside a pod block. Skipping to next block.

Around line 1245:

=cut found outside a pod block. Skipping to next block.

Around line 1269:

=cut found outside a pod block. Skipping to next block.

Around line 1293:

=cut found outside a pod block. Skipping to next block.

Around line 1303:

Unknown directive: =method

Around line 1308:

Unknown directive: =signature

Around line 1312:

Unknown directive: =metadata

Around line 1356:

=cut found outside a pod block. Skipping to next block.

Around line 1380:

=cut found outside a pod block. Skipping to next block.

Around line 1404:

=cut found outside a pod block. Skipping to next block.

Around line 1428:

=cut found outside a pod block. Skipping to next block.

Around line 1451:

=cut found outside a pod block. Skipping to next block.

Around line 1475:

=cut found outside a pod block. Skipping to next block.

Around line 1499:

=cut found outside a pod block. Skipping to next block.

Around line 1523:

=cut found outside a pod block. Skipping to next block.

Around line 1533:

Unknown directive: =method

Around line 1538:

Unknown directive: =signature

Around line 1542:

Unknown directive: =metadata

Around line 1586:

=cut found outside a pod block. Skipping to next block.

Around line 1610:

=cut found outside a pod block. Skipping to next block.

Around line 1634:

=cut found outside a pod block. Skipping to next block.

Around line 1658:

=cut found outside a pod block. Skipping to next block.

Around line 1681:

=cut found outside a pod block. Skipping to next block.

Around line 1705:

=cut found outside a pod block. Skipping to next block.

Around line 1729:

=cut found outside a pod block. Skipping to next block.

Around line 1753:

=cut found outside a pod block. Skipping to next block.

Around line 1763:

Unknown directive: =method

Around line 1767:

Unknown directive: =signature

Around line 1771:

Unknown directive: =metadata

Around line 1815:

=cut found outside a pod block. Skipping to next block.

Around line 1839:

=cut found outside a pod block. Skipping to next block.

Around line 1863:

=cut found outside a pod block. Skipping to next block.

Around line 1887:

=cut found outside a pod block. Skipping to next block.

Around line 1910:

=cut found outside a pod block. Skipping to next block.

Around line 1934:

=cut found outside a pod block. Skipping to next block.

Around line 1958:

=cut found outside a pod block. Skipping to next block.

Around line 1982:

=cut found outside a pod block. Skipping to next block.

Around line 1992:

Unknown directive: =method

Around line 1996:

Unknown directive: =signature

Around line 2000:

Unknown directive: =metadata

Around line 2044:

=cut found outside a pod block. Skipping to next block.

Around line 2068:

=cut found outside a pod block. Skipping to next block.

Around line 2092:

=cut found outside a pod block. Skipping to next block.

Around line 2116:

=cut found outside a pod block. Skipping to next block.

Around line 2139:

=cut found outside a pod block. Skipping to next block.

Around line 2163:

=cut found outside a pod block. Skipping to next block.

Around line 2187:

=cut found outside a pod block. Skipping to next block.

Around line 2211:

=cut found outside a pod block. Skipping to next block.

Around line 2221:

Unknown directive: =method

Around line 2225:

Unknown directive: =signature

Around line 2229:

Unknown directive: =metadata

Around line 2247:

=cut found outside a pod block. Skipping to next block.

Around line 2267:

=cut found outside a pod block. Skipping to next block.

Around line 2288:

=cut found outside a pod block. Skipping to next block.

Around line 2300:

Unknown directive: =method

Around line 2306:

Unknown directive: =signature

Around line 2310:

Unknown directive: =metadata

Around line 2348:

=cut found outside a pod block. Skipping to next block.

Around line 2358:

Unknown directive: =method

Around line 2367:

Unknown directive: =signature

Around line 2371:

Unknown directive: =metadata

Around line 2401:

Unknown directive: =method

Around line 2407:

Unknown directive: =signature

Around line 2411:

Unknown directive: =metadata

Around line 2441:

Unknown directive: =method

Around line 2446:

Unknown directive: =signature

Around line 2450:

Unknown directive: =metadata

Around line 2489:

=cut found outside a pod block. Skipping to next block.

Around line 2499:

Unknown directive: =method

Around line 2504:

Unknown directive: =signature

Around line 2508:

Unknown directive: =metadata

Around line 2552:

=cut found outside a pod block. Skipping to next block.

Around line 2576:

=cut found outside a pod block. Skipping to next block.

Around line 2600:

=cut found outside a pod block. Skipping to next block.

Around line 2624:

=cut found outside a pod block. Skipping to next block.

Around line 2647:

=cut found outside a pod block. Skipping to next block.

Around line 2671:

=cut found outside a pod block. Skipping to next block.

Around line 2695:

=cut found outside a pod block. Skipping to next block.

Around line 2719:

=cut found outside a pod block. Skipping to next block.

Around line 2729:

Unknown directive: =operator

Around line 2745:

=cut found outside a pod block. Skipping to next block.

Around line 2755:

Unknown directive: =operator

Around line 2771:

=cut found outside a pod block. Skipping to next block.

Around line 2781:

Unknown directive: =operator

Around line 2797:

=cut found outside a pod block. Skipping to next block.

Around line 2807:

Unknown directive: =partials