Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Non-greedy regex behaves greedily

by tphyahoo (Vicar)
on Nov 10, 2004 at 19:20 UTC ( [id://406758]=note: print w/replies, xml ) Need Help??


in reply to Non-greedy regex behaves greedily

Yes, the left hand side (except for the last closing bracket)
<body.+?
is finding out to
<body>
and then continuing out till it hits the next closing bracket. Problem is + finds AT LEAST one character. You want the star * here:
s/<body.*?>/<body class="theBody">/is
* finds 0 or more characters. That should solve it! :)

Replies are listed 'Best First'.
Re^2: Non-greedy regex behaves greedily
by fourmi (Scribe) on Nov 11, 2004 at 13:56 UTC
    indeedy, thanks a lot

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-20 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found