Heh, I apologise. What I read, and what is actually there sound very similar but mean completely different things (eg. just add an 's' and you get what I was responding to).

Having failed at my first attempt to understand the problem, what is it you're trying to solve? Though I can think of uses for such a modification, I can't actually think of any instance where I would prefer them over other solutions because in one case (where you're just looking for a token) I'd already have the token from $findtok or $matchtok, and in the other case (where I may be dynamically storing user IDs in a %var and recalling information using $read and a corresponding line number) variables would potentially limit my solution.

Having said that, even having this solution likely wouldn't stop mIRC from scanning through the string, looking for a token #x if/when you later call $gettok. It's a moot attempt at optimisation that regular expressions already provide, among other things.

Code:
alias regex_example {
  var %tokstr = a b c d
  var %regex = /([^ ]+)(?:[ ]+)?/g
  var %toknum = $regsubex(%tokstr,%regex,$iif(\t == c,\n))
}

Last edited by s00p; 11/01/10 03:09 PM.