NAME
Regexp - Object Oriented interface to perl's regular expression code
SYNOPSIS
use Regexp;
my $re = new Regexp q/Some Pattern/;
if (match $re "Some String") { ... }
$re->prematch
$re->postmatch
$re->pattern
my @info = $re->parentheses
my $count = $re->parentheses
DESCRIPTION
CONSTRUCTORS
- new ( PATTERN [, FLAGS ] )
-
new
compiles the givenPATTERN
into a new Regexp object. See perlre for a description ofPATTERN
A second optional parameter,
FLAGS
, can be used to control how the pattern is compiled.FLAGS
is a numeric value which can be constructed by or-ing together constants which Regexp conditionally exports. The constants are : - current ()
-
Returns an object which represents the current (last) pattern.
METHODS
- match ( STRING [, OFFSET [, FLAGS]] )
-
match
is like the=~
operator in perl.STRING
is the string which the regexp is to be applied.OFFEST
andFLAGS
are both optional.OFFSET
, if given, directs the regexp code to start trying to match the regexp at the given offset from the start ofSTRING
FLAGS
is a numeric value which can be constructed by or-ing together constants which Regexp conditionally exports. The constants are :- GLOBAL
-
Match as many times as possible, starting each time where the previous match ended. See
/g
option in perlre
- nparens
-
Returns the number of parentheses in the expression
- lastparen
-
Returns the number of the last parentheses that matched.
- minlength
-
Returns the minimum length that a string has to be before it will match the regular expression
- pattern
-
Returns the pattern text
- parentheses
- prematch
-
Returns the text preceeding the text of the last match
- lastmatch
-
Returns the text of the last match
- postmatch
-
Returns the text following the text of the last match
- length
-
Returns the length of the text in the last match
- endpos ()
-
Returns the offset into the original string to the start of the text following the last match.
AUTHORS
Regexp is a combination of two previous modules by Nick Ing-Simmons <nick@ni-s.u-net.com> and Ilya Zakharevich <ilya@math.ohio-state.edu> combined together by Graham Barr <bodg@tiuk.ti.com>