NAME
Regexp::RegGrp - Groups regular expressions
VERSION
Version 0.01_01
DESCRIPTION
Groups regular expressions to one regular expression
SYNOPSIS
use Regexp::RegGrp;
my $reggrp = Regexp::RegGrp->new( [ { regexp => '%name%', replacement => 'John Doe' }, { regexp => '%company%', replacement => 'ACME' } ] );
$reggrp->exec( \$scalar );
To return a scalar without changing the input simply use (e.g. example 2):
my $ret = $reggrp->exec( \$scalar );
The first argument must be a scalarref.
EXAMPLES
- Example 1
-
Common usage.
#!/usr/bin/perl use strict; use warnings; use Regexp::RegGrp; my $reggrp = Regexp::RegGrp->new( [ { regexp => '%name%', replacement => 'John Doe' }, { regexp => '%company%', replacement => 'ACME' } ] ); open( INFILE, 'unprocessed.txt' ); open( OUTFILE, '>processed.txt' ); my $txt = join( '', <INFILE> ); $reggrp->exec( \$txt ); print OUTFILE $txt; close(INFILE); close(OUTFILE);
- Example 2
-
A scalar is requested by the context. The input will remain unchanged.
#!/usr/bin/perl use strict; use warnings; use Regexp::RegGrp; my $reggrp = Regexp::RegGrp->new( [ { regexp => '%name%', replacement => 'John Doe' }, { regexp => '%company%', replacement => 'ACME' } ] ); open( INFILE, 'unprocessed.txt' ); open( OUTFILE, '>processed.txt' ); my $unprocessed = join( '', <INFILE> ); my $processed = $reggrp->exec( \$unprocessed ); print OUTFILE $processed; close(INFILE); close(OUTFILE);
AUTHOR
Merten Falk, <nevesenin at cpan.org>
BUGS
Please report any bugs or feature requests to bug-javascript-packer at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Regexp-RegGrp.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Regexp::RegGrp
COPYRIGHT & LICENSE
Copyright 2010 Merten Falk, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.