goff has asked for the wisdom of the Perl Monks concerning the following question:
output is#!perl my $text = "test1 zzzzzzzzzzzzzzz test2 test3 test4 test5 zzzzzzzzzzzz +zzz test6 test7 zzzzzzzzzzzzzzz test8 test9 test10"; # search for a-z0-9_ followed by whitespace then zzzzzzzzz then whites +pace then a-z0-9_ if ( $text =~ /([a-zA-Z0-9]+\s+[z]{15}\s+[a-z0-9]+)/ ) { print "string \$1: " . $1 . "!\n"; print "string \$2: " . $2 . "!\n"; } else { print "string not found...!\n"; } print "text is " . $text . "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex question
by bobf (Monsignor) on Jul 22, 2006 at 19:56 UTC | |
|
Re: regex question
by Hue-Bond (Priest) on Jul 22, 2006 at 19:55 UTC | |
|
Re: regex question
by GrandFather (Saint) on Jul 22, 2006 at 20:48 UTC | |
|
Re: regex question
by swampyankee (Parson) on Jul 22, 2006 at 20:13 UTC |