in reply to Extracting substrings
with look ahead and look behind
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $string = 'WhateverFooBlahBarMoreFooStuffBarMore'; my @words = $string =~ / (?<=Foo) (.*?) (?=Bar) /gx; print Dumper \@words;
hth,Output: $VAR1 = [ 'Blah', 'Stuff' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting substrings
by ambrus (Abbot) on Feb 18, 2008 at 15:25 UTC |