in reply to Need to pull substring between two escape sequences.
Assuming your string isn't perverse (like having
an escaped '#!' as part of the string literal):
my @matches = ($string =~ /!#(.*?)#!/g);
The .*? insures non-greedy matching and the /g applies it across the entire string. The params "capture" your string, and a list of all matching strings will be returned.
my @matches = ($string =~ /!#(.*?)#!/g);
The .*? insures non-greedy matching and the /g applies it across the entire string. The params "capture" your string, and a list of all matching strings will be returned.
|
---|
In Section
Seekers of Perl Wisdom