No such thing as a small change | |
PerlMonks |
Clarification on greedinessby prasadbabu (Prior) |
on Nov 25, 2004 at 12:26 UTC ( [id://410378]=perlquestion: print w/replies, xml ) | Need Help?? |
prasadbabu has asked for the wisdom of the Perl Monks concerning the following question: Hi monks I need some clarifications in greediness. The input file has the following text:
In the above input file i want to fetch the <first>\d+</first> tag in the content model in which the content tag has the text 'maps'. I tried with the following code using zero width assertions. But it is not matching the minimum match. It is matching from the begining of the <first> tag. (@arr) = $str =~ /(<first>((?!<first>).*?))<content>maps<\/content>/gsi;I dont know where i am going wrong. The output i need is: <first>25</first>Thanks in advance Prasad janitored by ybiC: Retitle from "greediness" because onewordnodetitles hinder site search
Back to
Seekers of Perl Wisdom
|
|