So I recently began rescripting an IRCd in mIRC for the first time in over a decade.
Anyway, I was trying to convert an ident to legal characters (a-z, A-Z, 0-9, - _ and .) using the following code:
alias -l legalIdentChar {
; $legalIdentChar(<char>)
if ($pos(abcdefghijklmnopqrstuvwxyz1234567890-.,$1,1) > 0) { return $1 }
else { return _ }
; `-> _ is also a valid character, but it's easier to sweep it under this.
}
alias -l legalizeIdent {
; $legalizeIdent(<args>)
return $regsubex($1,/(.)/g,$legalIdentChar(\t))
}
But I noticed this:
$legalizeIdent(J) > J
$legalizeIdent(J@) > J_
^-> Are fine, but...
$legalizeIdent(£) > __
$legalizeIdent(<random kanji which the forum converted>) > ___
Any reason why it's returning more than one _ for a single character? Or this is a bug?