
Regexp - Object Oriented interface to perl's regular expression code

use Regexp;
my $re = new Regexp q/Some Pattern/;
if (match $re "Some String") { ... }
$re->prematch
$re->postmatch
$re->pattern
my @info = $re->backref
my $count = $re->backref


new compiles the given PATTERN into a new Regexp object. See perlre for a description of PATTERN
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 :
Returns an object which represents the current (last) pattern.

Returns the minimum length that a string has to be before it will match the regular expression
Returns the pattern text
match is like the =~ operator in perl. STRING is the string which the regexp is to be applied. OFFEST and FLAGS are both optional.
In a scalar context match returns a true or false value depending on whether the match was sucessful. In an array context match returns an array of the contents of all the backreferences, or an empty array.
OFFSET, if given, directs the regexp code to start trying to match the regexp at the given offset from the start of STRING
FLAGS is a numeric value which can be constructed by or-ing together constants which Regexp conditionally exports. The constants are :
Returns the number of parentheses in the expression
Returns the number of the last parentheses that matched.
The result of backref is sensetive to how it is called.
If called with a single argument then backref returns the text for the given backreference in the pattern. Backreferences are numbered from 1 as with $1..$9.
If called with a single argument of zero, then backref will return the text of the last match. (Same as lastmatch)
If called without any arguments, and in a scalar context, then backref will return the number of backreferences that there are in the Regexp object. (Same as nparens)
If called without any arguments, and in aN array context, then backref will return a list of all the backreference values from the last match.
Returns the text preceeding the text of the last match
Returns the text of the last match
Returns the text following the text of the last match
Returns the offset into the original string to the start of the text in the last match.
Returns the length of the text in the last match
Returns the offset into the original string to the end of the text in the last match.

Regexp is a combination of work by Nick Ing-Simmons <nick@ni-s.u-net.com> and Ilya Zakharevich <ilya@math.ohio-state.edu> brought together and improved by Graham Barr <bodg@tiuk.ti.com>