You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A top-level recursive call, i.e. (?R) or (?0), only uses the first alternative, and ignores all subsequent ones.
As a simple example, a(?R)|z will only match z, but it is supposed to be able to also match az. The workaround is to use (?:a(?R)|z) or (a(?R)|z) or (a(?1)|z), which can match either az or z.
I have tested and confirmed this to be happening in the latest version of Notepad++, v8.4.4 (released yesterday), which uses presumably the latest (or at least a very recent) version of Boost as its regex engine.
A top-level recursive call, i.e.
(?R)
or(?0)
, only uses the first alternative, and ignores all subsequent ones.As a simple example,
a(?R)|z
will only matchz
, but it is supposed to be able to also matchaz
. The workaround is to use(?:a(?R)|z)
or(a(?R)|z)
or(a(?1)|z)
, which can match eitheraz
orz
.The regex which actually led to discovery of this bug was (?=(xx+?)\1*(?=\1$)((?R)))(?=(x+)\3*(?=\3$)((?R)))\2\4|x\B(?R)|, which calculates the OEIS A064097 number sequence in unary. But to make it work in the current version of Boost, the entire regex must be enclosed in parentheses.
I have tested and confirmed this to be happening in the latest version of Notepad++, v8.4.4 (released yesterday), which uses presumably the latest (or at least a very recent) version of Boost as its regex engine.
Sample program demonstrating the bug:
This should print three identical lines of
az
, but instead printsz
followed by two lines ofaz
.The text was updated successfully, but these errors were encountered: