Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Pattern Matching

by si_lence (Deacon)
on Feb 01, 2005 at 09:10 UTC ( #426841=note: print w/ replies, xml ) Need Help??


in reply to Pattern Matching

Hi

my underdastanding is that ".*?" eats up much more than you want it to,
because the overall match has to succeed. It can match without giving up
the initial match of  <index-entry id= and therfore it will.

if you change it to

$str =~ s#<index-entry id="[^"]*"><index-heading></index-heading>\n</i +ndex-entry>##gsi;

it should work.
But this looks like XML of some kind so maybe your better off using a
module for this kind of tasks anyway?
si_lence


Comment on Re: Pattern Matching
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://426841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-07-14 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls