I'm no expert in mirc's regex functions, can you retrieve the whole match?
you mean the portion of the string consumed by the engine in a successful match, ie. the first two integers of the vector returned by PCRE? if so, then unfortunately it isn't possible. for a static expression, such as those that we are dealing with here, we can easily modify the expression to get the result we want as you did, by using a capturing group and $regml(). for a dynamic expression, it's a bit trickier, and i've had cases where an extra $regml() property, or $regml(-1) support, or new $regsubex() marker, would have been very convenient indeed!
I would suggest to include (*ANYCRLF) at the start of patterns that will work with multi-line subjects. That way carriage returns won't be treated like normal characters.
the effect of using (*ANYCRLF) here, having CR treated as a new line character as well as the default LF, is to prevent the '.' in '.+?' from being able to match a lone CR. so, whereas "<title>text \r here</title>" would normally be matched and 'text \r here' captured as $regml(1), with (*ANYCRLF) this doesn't happen.
so all (*ANYCRLF) is serving to do in this case is restrict the set of strings which are matched by the rest of the expression. this is presumably not what the Tomao wants; what he wants is quite the opposite, to broaden this set to include titles that may possibly span multiple lines. we need quite the opposite effect: instruct PCRE to allow '.' to match a new line character by enabling the DOTALL option via the 's' modifier:
(?s)<title>\s*\K.+?(?=\s*<\/title>)
Tomao, this assumes you're sending the entire series of lines separated by CRLF or LF to $regex(). it isn't especially clear to me that this is what you're doing, though i suppose it is the most sensible interpretation of your problem