Well, I was hoping for a quick fix and beta release because this issue is breaking my bot (this issue is present since 7.55 iirc).

While the above issue is related to /g, I believe it's still a wrong increment that has nothing to do with the /g implementation as a whole.
But, I found another issue regarding /g itself (thanks to the author of regex101.com), $regex(a,/a??/g) should result in 3 matches, the first one should be an empty string, the second one should be on "a", and the third one should be an empty string.

In mIRC, the first two matches are empty, and the third match is on "a".

The reason for this result is that the second '?' makes the first quantifier '?' non greedy, i will first attempt to match 'a' 0 time, and since that suceeds, an empty string is returned.
What should be done in this case is retry the match at the same position with the option PCRE_NOTEMPTY_ATSTART and PCRE_ANCHORED, and since that's the exact same match, PCRE_NOTEMPTY_ATSTART invalidate that match, meaning pcre is now trying to match 'a' 1 time, and succeeds, which is why the second match should be on 'a'. At this point mIRC should try the next position and find an empty match at the end of the string.
regex101.com and PHP behave correctly, and this is still according to the recommendation from pcre I pasted in previous posts in this thread.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel