turbo3k has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to do something like this? Thanks in advance!#!/usr/bin/perl -w use strict; my $string = "Field1: one"; my @regex; push(@regex, 'm/Field1: (\w{3})/'); push(@regex, 'm/Field2: (\w{3})/'); push(@regex, 'm/Field3: (\w{3})/'); foreach $_ (@regex) { $string =~ $_; print "$1\n" if defined $1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RegEx Array
by Enlil (Parson) on Apr 12, 2004 at 05:45 UTC | |
|
Re: RegEx Array
by davido (Cardinal) on Apr 12, 2004 at 05:43 UTC | |
|
Re: RegEx Array
by tachyon (Chancellor) on Apr 12, 2004 at 06:54 UTC | |
|
Re: RegEx Array
by graff (Chancellor) on Apr 12, 2004 at 06:00 UTC | |
|
Re: RegEx Array
by pbeckingham (Parson) on Apr 12, 2004 at 14:47 UTC |