Hello, I'm afraid your code wrong, to say the least, this is not how you should use on rawmode to check if a mode apply to you, this code can even incorrectly triggers (if someone voice someone and set a mode +k with a key containing your nickname), not to mention that your nickname could contain character that could be interpreted by the regex engine, which would need to be sanitized anyway, but the correct solution does not involve regex, yes it's probably doable with regex but it's besides the point.
Here is a code taken from this thread which I adapted: https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/39250/

Code
ON *:RAWMODE:#:{
  var %takepara $remove($gettok($chanmodes,1-3,44),$chr(44)),%i 1,%j 2,%set 1
  while ($mid($1,%i,1)) {
    var %t $v1
    if (%t == +) %set = 1
    elseif (%t == -) %set = 0
    elseif (%t isin $nickmode) {
      var %nick = $eval($chr(36) $+ %j,2)
      if ($istokcs(Y y q a o h v,%t,32)) && (%nick == $me) {
        if (%set) { msg $chan thanks for the $replacex(%t,Y,ojoin,y,oper,o,operator,h,halfop,a,admin,q,owner,v,voice) $nick $+ ! }
        else { msg $chan  why did u do that man why $+ $chr(44) i hate u for removing $replacex(%t,Y,ojoin,y,oper,o,operator,h,halfop,a,admin,q,owner,v,voice)) $nick $+ ! }
      }
      inc %j
    }
    elseif (%t isin %takepara) inc %j
    inc %i
  }
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel