Venus::Regexp - Regexp Class
Regexp Class for Perl 5
package main; use Venus::Regexp; my $regexp = Venus::Regexp->new( qr/(?<greet>\w+) (?<username>\w+)/, ); # $regexp->search;
This package provides methods for manipulating regexp data.
This package inherits behaviors from:
Venus::Kind::Value
This package provides the following methods:
default() (Regexp)
The default method returns the default value, i.e. qr//.
qr//
Since 0.01
0.01
# given: synopsis; my $default = $regexp->default; # qr/(?^u:)/
replace(Str $string, Str $substr, Str $flags) (Replace)
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.
package main; use Venus::Regexp; my $regexp = Venus::Regexp->new( qr/(?<username>\w+)$/, ); my $replace = $regexp->replace('Hey, unknown', 'cpanery'); # bless({ ... }, 'Venus::Replace')
search(Str $string) (Search)
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.
package main; use Venus::Regexp; my $regexp = Venus::Regexp->new( qr/(?<greet>\w+), (?<username>\w+)/, ); my $search = $regexp->search('hey, cpanery'); # bless({ ... }, 'Venus::Search')
This package overloads the following operators:
(eq)
This package overloads the eq operator.
eq
example 1
# given: synopsis; my $result = $regexp eq '(?^u:(?<greet>\\w+) (?<username>\\w+))'; # 1
(ne)
This package overloads the ne operator.
ne
# given: synopsis; my $result = $regexp ne '(?<greet>\w+) (?<username>\w+)'; # 1
(qr)
This package overloads the qr operator.
qr
# given: synopsis; my $result = 'Hello Friend' =~ $regexp; # 1
Cpanery, cpanery@cpan.org
cpanery@cpan.org
Copyright (C) 2021, Cpanery
Read the "license" file.
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.