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' ];
In reply to Re: Extracting substrings
by poolpi
in thread Extracting substrings
by bontchev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |