Interesting. As has been mentioned before, .* here is bad because it's greedy and will prevent you from finding two matches on a line. Furthermore, .* is usually pretty inefficient -- the regexp has to match everything to the end of the line and then start backtracking to try to match whatever follows the .*. (.*? is better but still less than ideal to because it needs to look ahead one character in every step. If '[' is only allowed in tags, then [^[]* is the best.)
Also, why use $before and $after rather than $` and $' directly? Of course, if at all possible, you shouldn't be using $` and $' at all (see Why does using $&, $`, or $' slow my program down? in perlfaq6).
Cheers, mate!
In reply to Re: Re: Monks' Expression
by eg
in thread Monks' Expression
by sinan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |