Gee... I'm pretty sure we are talking but not communicating. Hehe.. Try #3...

Its obvious (and I stated this originally) that the problem is in the way mIRC parses its input. I think you and I are agreeing on this. HOWEVER, what you appear to be missing is that the /expression/ syntax doesn't adhere to normal parsing rules already. Does the expression /%temp/ evaluate the %temp variable or match the string "%temp"? Does the [ ] define character sets or force evaluation? Does $+ concatonate? If all of these don't have their script meaning then why should I expect ()'s to be handled differently until the terminating / is encountered? Its a bug... deal with it.


And finally, you only see a simple answer to a trivial example that illustrates the problem. Its that forest and tree problem... Consider your proposed solution:

$regex(teststring,/(test)st(d?)(ring)/

I think that actually worked (which surprised me) but you missed the point because its NOT extendable to ANYTHING more complex than a single character... Try these...

//var %a teststring | echo -a $regex(TEST, %a, /(test)st(dd)?(ring)/) | echo a $regml(TEST, 2)
//var %a teststddring | echo -a $regex(TEST, %a, /(test)st(dd)?(ring)/) | echo a $regml(TEST, 2)

Notice how the fields change now?

Or for a PERFECT example... try this:
//var %a teststringring | echo %a $regex(TEST, %a, /(test)st(dd)?(ring)\3/) | echo a $regml(TEST, 3)

You'll note that \3 (which is the 3rd left paren subexpression correctly matches "ring") and thus it returns a successful match against its input but attempts to access the 3rd match field returns nothing. Examination of $regml(TEST, 2) contains "ring" but this is incorrect. And thus I once again state that $regml returns the incorrect answer but that the regular expression library knows what its doing...

What more do I need to say?

-Yil