in reply to Re: Regarding Regular Expressions
in thread Regarding Regular Expressions

Solutions involving substitution are not what the OP wants. How about this:

my @results = $mystr =~ /(efg)/g;
Taken literally, "e followed by fg" is efg. If other characters may come between, try:
my @results = $mystr =~ /(e.*?fg)/g;



pbeckingham - typist, perishable vertebrate.

Replies are listed 'Best First'.
Re^3: Regarding Regular Expressions
by borisz (Canon) on Aug 17, 2004 at 13:28 UTC
    Thats wrong, since the example has more 'fg' as 'e' so every hit starts at the first e and ends at x's 'fg'.
    $input = 'xxxxefghijklfghijklabcdefg'; __OUTPUT__ efg efghijklfg efghijklfghijklabcdefg
    Boris