Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://426841]
help
Chatterbox?
[Your Mother]: oiskuu, I think we should just be friends.
[marto]: the 'cool' place to hang out
[Your Mother]: ♫ Caffeine, caffeine, caffeine, caffeine. There will be answer, caffeine. ♫ ♬
[oiskuu]: Ahh, old cats with rheuma. I think (s)he was saying, "dude, NOT cold enough."

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2017-12-18 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (489 votes). Check out past polls.

    Notices?