mIRC Homepage
Posted By: Wims Incorrect regex result in latest beta - 15/01/18 02:14 AM
It looks like the fix for \K from jaytea's report broke regex support:
Code:
//echo -a $regex(56 233 48 48 ,/(\d+)(?: |$)/g) $regml(1) $regml(2)
$regml(2) should be 233
Posted By: jaytea Re: Incorrect regex result in latest beta - 15/01/18 06:42 AM
it may be helpful to mention that this is only affecting the first iteration of the g-option implementation:

Code:
//echo -a $regsubex(abcde, /./g, x)


produces "xbxxx".

we can further observe that the second match is only detected correctly when it doesn't immediately follow the first:

Code:
//echo -a $regex(abcdef, /abc|e|f/g) - $regex(abcdef, /abc|d|f/g)


produces "3 - 2".

it appears that the "offset advance by 1" measure added to the demo code to protect against infinite loops when \K is used in lookbehinds is being triggered for all cases in the first iteration of the loop.

pure speculation: the workaround for get_startchar() may involve a variable that doesn't get initialized before the loop, so its first use is bugged.
Posted By: Khaled Re: Incorrect regex result in latest beta - 15/01/18 09:57 AM
Thanks for your bug report. This issue has been fixed for the next version.
Posted By: Wims Re: Incorrect regex result in latest beta - 15/01/18 11:58 AM
Thanks, is it possible to get a new beta quickly with this fix, as it's breaking my scripts heavily and I'd rather keep using the betas?
I agree with wims here. Can't test the beta as many of my scripts break due to this issue
© mIRC Discussion Forums