mIRC Homepage

regsubex- color the digits

Posted By: kap

regsubex- color the digits - 12/08/19 04:44 PM

Code
alias test {
  var %text {"coord":{"lon":3.57,"lat":51.46},"weather":[{"id":310,"main":"Drizzle","description":"light intensity drizzle rain","icon":"09d"},{"id":521,"main":"Rain","description":"shower rain","icon":"09d"},{"id":200,"main":"Thunderstorm","description":"thunderstorm with light rain","icon":"11d"}],"base":"stations","main":{"temp":16.66,"pressure":1014,"humidity":72,"temp_min":15,"temp_max":18.89},"visibility":10000,"wind":{"speed":5.7,"deg":270},"clouds":{"all":100},"dt":1565618207,"sys":{"type":1,"id":1553,"message":0.0087,"country":"NL","sunrise":1565583963,"sunset":1565637345},"timezone":7200,"id":2745392,"name":"Vlissingen","cod":200}
  var %pattern /(\d+)/g
  var %subtext $chr(3) $+ 07\1 $+ $chr(15)
  echo -a $regsubex(%text,%pattern,%subtext)
}


[Linked Image from i.imgur.com]

Running this on a vanilla version 7.57...

What am I doing wrong?

edit: https://regex101.com/r/bLJWT4/1
Posted By: Wims

Re: regsubex- color the digits - 12/08/19 05:12 PM

Looks like mIRC is the one doing it wrong

Code
//echo -a $regsubex(a1b,(\d+), this one is fine: \1 - still fine: c\1d - bug??: $chr(3) $chr(3) 07\1)
- the bug doesn't occur because the color sequence is ended

Code
//echo -a $regsubex(a1b,(\d+), this one is fine: \1 - still fine: c\1d - bug??: $chr(3) 07\1)
- the bug shows up, $+ not even required
scratch that, that was huge non sense!

The markers (\1 here) have to appear literaly in the subtext parameter of $regsubex.
Posted By: kap

Re: regsubex- color the digits - 12/08/19 06:34 PM

Thanks! You're right, it's working now!
© 2020 mIRC Discussion Forums