![]() |
|
go ahead... be a heretic | |
PerlMonks |
extract substring between token a and token bby philosophia (Sexton) |
on Jul 29, 2004 at 00:44 UTC ( #378259=perlquestion: print w/replies, xml ) | Need Help?? |
philosophia has asked for the wisdom of the Perl Monks concerning the following question:
hi i'm trying to extract $substring from $text - where $text is a block of html and $substring is anything between <!--begin--> and <!--/end--> in $text. i've tried $text =~ /%<\!--begin-->%(.*?)%<\!--end-->/; $substring = $1; print $substring; but this doesn't seem to be working. i'm not sure if my regex is right first of all. also, is there any way to do this without using the global variable $1? thanks
Back to
Seekers of Perl Wisdom
|
|