Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 having an uproarious good time at the Monastery: (8)
As of 2014-08-30 03:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls