in reply to Re: repeating patterns
in thread repeating patterns
OK, you have a string that has an unknown number of occurences of the pattern "a (something)foobara"; and you want to grab all of those instances. The tag in the middle can change; so the key is to use the fact that you can interpolate variables into a regex.
#since delimiter may contain special regex characters, # make sure you escape them my $delim = quotemeta("DELIMITER"); my @matches = $string =~ /a${delim}foobar/g;
Will, *I think*, do what you want. But this might not get you what you want when you're dealing with real data, so beware.
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
|
|---|