To clarify, there are two different "greedy" at work here. Yours, Tomao, would be greedy in that it would take everything until the final matching text. So, as hixxy mentioned, you would capture everything to the last </span>. If you only have one on a line, that's not going to hurt anything, but if there are multiple </span> on a line, you will get unwanted data. You also won't be able to get $regml(2) because there will only every be one match.

With hixxy's, the greedy means to accept multiple matches. The match only goes to the first </span>. Then, the next match, if there is one, will go to the next one and so on. So you can then use $regml(N) to get multiple matches if there is more than one on the line.

One other note... /g really shouldn't ever be needed in this specific case. Normally, there should never be more than one <title> tag on a page. But it's a good thing to understand because it is very useful for other situations.


Invision Support
#Invision on irc.irchighway.net