in reply to Re^2: Pattern Matching
in thread Pattern Matching

Just for the record, that's ill-formed html in your example:
<B><P ALIGN=CENTER>My Text I want to grab 1</B></FONT><p>
most of the issues will be ignored by most browsers, but are you certain? If displayed !eq actual, regex will have a hard time

(and, OT: writing 4.01 compliant code and using css IS worth the trouble -- for anything you're putting online, anyway)

Directly on your question: Note that your pattern is greedy, (.+), aka one-or-more-of-anything_except_a_newline. As written, $line =~ m/<B><P ALIGN\=CENTER>(.+)<\/B><\/FONT>/g; that should swallow everything UP TO the last end_bold_new_para tags.

And re capturing all instances: suggest you push to an array inside a foreach loop. The array subscript will be incremented for each new item found.