mIRC Homepage
Posted By: zati [7.xx] Bug in $regml().pos - 17/04/10 07:45 PM
$regml().pos counts 2 characters for each UTF-8 character.

To reproduce this bug, add this alias

Code:
alias test {
  var %num = $regex(mts,$1-,/(<[-_.a-zA-Z0-9]+>)/g)
  while (%num >= 1) {
    echo ** $regml(mts,%num) * $regml(mts,%num).pos
    dec %num
  }
}

Then type

Code:
/test testé <t> <a>


Results in mIRC 7.xx :
Code:
** <a> * 12
** <t> * 8


Results in mIRC 6.xx
Code:
** <a> * 11
** <t> * 7
Posted By: Collective Re: [7.xx] Bug in $regml().pos - 17/04/10 07:57 PM
The difference there is that mIRC 6.35 is not UTF-8-encoding the text before passing it to the regular expression engine. If you were to use $utfencode() in 6.35 you'd get the same result as on 7.01.
Posted By: zati Re: [7.xx] Bug in $regml().pos - 19/04/10 11:46 AM
Since $len() and $pos() reports correct length/position, I think $regml().pos should be corrected to be consistent with other identifiers.
Posted By: Khaled Re: [7.xx] Bug in $regml().pos - 23/04/10 04:00 PM
Thanks this has been fixed for the next version.
© mIRC Discussion Forums