ok, I'm not the world's best with regular expressions, but set your whole line in a variable called
%txt and apply the following line to count how many times they format [N;NNm makes an appearance.
$regex(%txt,/(\[[0-9];[0-9]{2}m)/g)
The problem is $ansi2mirc([1;34m) returns [1;34m for mem, so I'm probably doing something wrong in detecting the ansi code.
You can use this as a basis for a $regsub, to replace the ansi code with $ansi2mirc(ansicode)