0

I have a following code.

on $*:text:/^(!|\.)bypass\b/Si:#:{
 set %bypass.answer $2-
 %bypass.n = $regsub(%bypass.answer,/(.)/g,$chr(38) $+ $chr(35) $+ $asc(\1) $+ $chr(59), %bypass.answer)
 msg $chan %bypass.answer
}

Basically, I want !bypass <string> to display HTML characters for the string, but when I try !bypass abc it is giving me &#92;&#92;&#92; where 92 is ascii code for \ if I use just \1, it is showing &#a;&#b;&#c; but when i put it inside $asc( ), it is not working.

I have tryied $asc( [ \1 ] ) as well, without good result. What might be going wrong?

Hrishikesh
  • 1,076
  • 1
  • 8
  • 22

1 Answers1

0

I don't know the exact reason for the problem, but it works if you use $regsubex instead of $regsub.

on $*:text:/^(!|\.)bypass\b/Si:#:{
  var %answer $regsubex($2-,/(.)/g,$chr(38) $+ $chr(35) $+ $asc(\1) $+ $chr(59))
  msg $chan %answer
}
Kylar
  • 320
  • 2
  • 4