mIRC Home    About    Download    Register    News    Help

Print Thread
regsubex- color the digits #265908 12/08/19 04:44 PM
Joined: Feb 2015
Posts: 54
K
kap Online OP
Babel fish
OP Online
Babel fish
K
Joined: Feb 2015
Posts: 54
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

Last edited by kap; 12/08/19 05:04 PM.

irc://irc.mircscripts.net:+6697/chat
Re: regsubex- color the digits [Re: kap] #265909 12/08/19 05:12 PM
Joined: Jul 2006
Posts: 3,584
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,584
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.

Last edited by Wims; 12/08/19 06:21 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: regsubex- color the digits [Re: Wims] #265910 12/08/19 06:34 PM
Joined: Feb 2015
Posts: 54
K
kap Online OP
Babel fish
OP Online
Babel fish
K
Joined: Feb 2015
Posts: 54
Thanks! You're right, it's working now!


irc://irc.mircscripts.net:+6697/chat