Hi,

I use the following regex to split a (really simple) file into sections headed 
by <h1>.+?</h1>:

while ($content =~ m#<h1>(.+?)</h1>(.+?)(?=<h1>)#gs) {
    ...
}

This works perfectly, but obviously does not catch the last section, as it is 
not followed by <h1>.

How can I catch the last section without

* doing a separate match for it
* loosing the convenience of the g switch to wade through the whole file?

Thanks,

Jan
-- 
I'd never join any club that would have the likes of me as a member. - Groucho 
Marx

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to