mIRC Home    About    Download    Register    News    Help

Print Thread
#87684 20/06/04 11:28 PM
Joined: Apr 2004
Posts: 871
Sat Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
It seems that with /filter -gk, the called alias can not use $regml() to make back references to the fields in the filter's regex. I think it would be a nice addition if it could, similar to "on $*:TEXT" events for example.


Saturn, QuakeNet staff
#87685 21/06/04 06:01 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I'm not sure this would be easy to implement, because the matching lines are not passed to the -k alias 'on the fly'. Instead, they are added into an internal cache, from which the alias receives them once the filtering process is done. For us this means that $regml() will always hold the value of the last match.

This example shows what I mean:

alias test {
  • write f_file A | write f_file B | write f_file C
    filter -fkg f_file f_alias /(.)/g
    .remove f_file
}

alias -l f_alias {
  • linesep
    var %a = $regml(0), %b = 0
    echo -s Captured %a subpattern(s)
    while %a > %b { inc %b | echo -s - $regml(%b) }
    linesep
}

#87686 21/06/04 11:45 AM
Joined: Apr 2004
Posts: 871
Sat Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Hmm good point...I can see the problems that would arise if the alias were to be called on-the-fly. Too bad then!


Saturn, QuakeNet staff

Link Copied to Clipboard