in reply to help match this

/<a\s(.*)/s
:)

Honestly, you don't show where it should stop matching, so I can just grab the rest of the string.

I assume that actually, you want to match up to the next "<a", but that's just a guess. As there may not be a next anchor, the latter should be optional, thus, match up to the end of the string. So, try one of:

/<a\s((?:(?!<a\s).)*)/s /<a\s(.*?)(?:<a\s|$)/s

If your "html" is much more complex than this, you should look into using a HTML parser. I've used HTML::TokeParser::Simple with success in similar tasks in the past, so it's my first recommendation.

Replies are listed 'Best First'.
Re^2: help match this
by Silent-monk (Novice) on Jul 04, 2006 at 12:41 UTC
    Hey there bart,

    Your first anwser is very close, but the question is how to extract contents between "<a" to "NGC:003288", not to the next "<a", so I would change your first anwser to this:

    /<a\s(.*)NGC:003288/s;
    and it should turn up the desired result.

    Now, back to my meditation