GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Venus::Search(3) User Contributed Perl Documentation Venus::Search(3)

Venus::Search - Search Class

Search Class for Perl 5

  package main;
  use Venus::Search;
  my $search = Venus::Search->new(
    string => 'hello world',
    regexp => '(hello)',
  );
  # $search->captures;

This package provides methods for manipulating regexp search data.

This package has the following attributes:

  flags(Str)

This attribute is read-write, accepts "(Str)" values, is optional, and defaults to ''.

  regexp(Regexp)

This attribute is read-write, accepts "(Regexp)" values, is optional, and defaults to "qr//".

  string(Str)

This attribute is read-write, accepts "(Str)" values, is optional, and defaults to ''.

This package inherits behaviors from:

Venus::Kind::Utility

This package integrates behaviors from:

Venus::Role::Explainable

Venus::Role::Stashable

This package provides the following methods:

  captures() (arrayref)

The captures method returns the capture groups from the result object which contains information about the results of the regular expression operation. This method can return a list of values in list-context.

Since 0.01

captures example 1
  # given: synopsis;
  my $captures = $search->captures;
  # ["hello"]
    

  count() (number)

The count method returns the number of matches found in the result object which contains information about the results of the regular expression operation.

Since 0.01

count example 1
  # given: synopsis;
  my $count = $search->count;
  # 1
    

  evaluate() (arrayref)

The evaluate method performs the regular expression operation and returns an arrayref representation of the results.

Since 0.01

evaluate example 1
  # given: synopsis;
  my $evaluate = $search->evaluate;
  # ["(hello)", "hello world", 1, [0, 0], [5, 5], {}, "hello world"]
    
evaluate example 2
  package main;
  use Venus::Search;
  my $search = Venus::Search->new(
    string => 'hello world',
    regexp => 'hello:)',
  );
  my $evaluate = $search->evaluate;
  # Exception! (isa Venus::Search::Error) (see error_on_evaluate)
    

  explain() (string)

The explain method returns the subject of the regular expression operation and is used in stringification operations.

Since 0.01

explain example 1
  # given: synopsis;
  my $explain = $search->explain;
  # "hello world"
    

  get() (string)

The get method returns the subject of the regular expression operation.

Since 0.01

get example 1
  # given: synopsis;
  my $get = $search->get;
  # "hello world"
    

  initial() (string)

The initial method returns the unaltered string from the result object which contains information about the results of the regular expression operation.

Since 0.01

initial example 1
  # given: synopsis;
  my $initial = $search->initial;
  # "hello world"
    

  last_match_end() (maybe[within[arrayref, number]])

The last_match_end method returns an array of offset positions into the string where the capture(s) stopped matching from the result object which contains information about the results of the regular expression operation.

Since 0.01

last_match_end example 1
  # given: synopsis;
  my $last_match_end = $search->last_match_end;
  # [5, 5]
    

  last_match_start() (maybe[within[arrayref, number]])

The last_match_start method returns an array of offset positions into the string where the capture(s) matched from the result object which contains information about the results of the regular expression operation.

Since 0.01

last_match_start example 1
  # given: synopsis;
  my $last_match_start = $search->last_match_start;
  # [0, 0]
    

  matched() (maybe[string])

The matched method returns the portion of the string that matched from the result object which contains information about the results of the regular expression operation.

Since 0.01

matched example 1
  # given: synopsis;
  my $matched = $search->matched;
  # "hello"
    

  named_captures() (hashref)

The named_captures method returns a hash containing the requested named regular expressions and captured string pairs from the result object which contains information about the results of the regular expression operation.

Since 0.01

named_captures example 1
  # given: synopsis;
  my $named_captures = $search->named_captures;
  # {}
    
named_captures example 2
  package main;
  use Venus::Search;
  my $search = Venus::Search->new(
    string => 'hello world',
    regexp => '(?<locale>world)',
  );
  my $named_captures = $search->named_captures;
  # { locale => ["world"] }
    

  postmatched() (maybe[string])

The postmatched method returns the portion of the string after the regular expression matched from the result object which contains information about the results of the regular expression operation.

Since 0.01

postmatched example 1
  # given: synopsis;
  my $postmatched = $search->postmatched;
  # " world"
    

  prematched() (maybe[string])

The prematched method returns the portion of the string before the regular expression matched from the result object which contains information about the results of the regular expression operation.

Since 0.01

prematched example 1
  # given: synopsis;
  my $prematched = $search->prematched;
  # ""
    

  set(string $string) (string)

The set method sets the subject of the regular expression operation.

Since 0.01

set example 1
  # given: synopsis;
  my $set = $search->set('hello universe');
  # "hello universe"
    

This package may raise the following errors:

This package may raise an error_on_evaluate exception.

example 1

  # given: synopsis;
  my $input = {
    throw => 'error_on_evaluate',
    error => 'Exception!',
  };
  my $error = $search->catch('error', $input);
  # my $name = $error->name;
  # "on_evaluate"
  # my $message = $error->message;
  # "Exception!"
    

This package overloads the following operators:

This package overloads the "" operator.

example 1

  # given: synopsis;
  my $result = "$search";
  # "hello world"
    

example 2

  # given: synopsis;
  my $result = "$search, $search";
  # "hello world, hello world"
    
This package overloads the "." operator.

example 1

  # given: synopsis;
  my $result = $search . ', welcome';
  # "hello world, welcome"
    
This package overloads the "eq" operator.

example 1

  # given: synopsis;
  my $result = $search eq 'hello world';
  # 1
    
This package overloads the "ne" operator.

example 1

  # given: synopsis;
  my $result = $search ne 'Hello world';
  # 1
    
This package overloads the "qr" operator.

example 1

  # given: synopsis;
  my $result = 'hello world, welcome' =~ qr/$search/;
  # 1
    
This package overloads the "~~" operator.

example 1

  # given: synopsis;
  my $result = $search ~~ 'hello world';
  # 1
    

Awncorp, "awncorp@cpan.org"

Copyright (C) 2022, Awncorp, "awncorp@cpan.org".

This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.

2023-11-27 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.