Open RedCMD opened 2 years ago
Posix classes are some of the funkiest things in textmate.
The below regex is allowed and will match all upper case letters aswell as a
, b
and c
.
But if posix a value is inputted, the engine breaks:
kkos has fixed this issue https://github.com/kkos/oniguruma/commit/d1cf59269006481294896fb855153857d8bec928 https://github.com/kkos/oniguruma/commit/9b9365d0524d1bf60c1fc963be13260ff6b798aa
update version of oniguruma?
1.5.1
=> 6.9.6
This fix is included in oniguruma release 6.9.9 . https://github.com/kkos/oniguruma/commit/06f5c8198a3da4a8bdcc8c79d52034cd07bb96b7
If a symbol appears between [:
and :]
, it becomes a normal character class. ( except [[:^:]]
)
ex. [[:upper!:]]
== [[\:upper!:]]
oniguruma/src/regparse.c#L5106-L5139
POSIX bracket now works ideally, thank you.
VSCode is still using an old 2020 version https://github.com/kkos/oniguruma/releases/tag/v6.9.5_rev1
The regex
[[:upper:]]
works as expected at matching only upper case letters. Normally if you missspell anything inside the posix class, the textmate engine will fail. Except for a few noteble expcetions;]
,:
and[:
(only gonna focus on]
for now)[[:upp]er:]]
will work with matching:]
,u]
,p]
,e]
andr]
. (regex:[:uper]\]
). But if you escape the]
inside the posix class, then both square brackets acts as both the closing and opening brackets for the 2nd character class and as literary characters for the 1st class. Leaving the last]
competely out of the classes (and can be removed without error).[[:upp\]er:]]
will match the same as above but also with the added[
and]
.:]
,u]
,p]
,e]
r]
[]
and]]
. (regex:[\[:uper\]]\]
).[[:\]:]
will match[
,:
and]
. ~Placing a-
before the last:
causes textmate engine to fail[[:\]-:]
.~ (EDIT:\]-:
is an illegal character range) Regex works as expected if either:
is removed or moved one space away from their respected square bracket. (I have used a single\
instead of the required double\\
from json embeding)