I don't know Perl, but I can give you a general strategy.
- Find the first match. Remove all text up to and including it.
- Find the second match. Remove all text up to it.
- Search the remainder of the text.
Also, some regular expression engines allow you to specify a starting position in the string. If you are allowed to do that, you can avoid having to chop off parts of the string.