in reply to Is there a Limit on Matching .*
Is that what's happening here?
No. There's no arbitrary limit on the number of characters dot-star can match.
What's happening in your case, I'll bet, is that you have newlines in your $chunk and forgot that a dot doesn't match a newline unless you include the /s modifier on the regex.
Be careful about setting your input record separator to '</h1>' too. That's an exact string and will be case sensitive.
I guess I'd be remiss without including some standard scolding like, "you should parse HTML with an HTML parser, not a regex."
"My two cents aren't worth a dime.";