▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Плагины/Luamine-re2addon

Luamine-re2addon

Regular expression (RegEx) support for advanced text processing in LuaMine.

Оцените первым
14
1

Re2Addon

Adds RE2 regular expression support to LuaMine scripts, via the re2j library.

Requires LuaMine to be installed and enabled.

Why RE2 instead of standard regex?

RE2 is specifically designed to guarantee linear-time matching with no catastrophic backtracking — the class of bug where a crafted or just unlucky regex pattern can hang a thread for seconds or minutes on certain inputs. That matters here: LuaMine scripts are, by nature, less trusted than your own server code, so exposing regex to them safely means picking an engine that can't be turned into a denial-of-service vector by an ordinary (even non-malicious) pattern.

Usage

local re2 = require("re2")

-- Free functions - pattern as a string
re2.matches("[0-9]+", "hello123")        -- false (whole string must match)
re2.find("[0-9]+", "hello123world")      -- 5, 8
re2.findAll("[0-9]+", "a1 b22 c333")     -- table of {start, end, match}
re2.replace("[0-9]+", "a1b2c3", "X")     -- "aXb2c3" (first match only)
re2.replaceAll("[0-9]+", "a1b2c3", "X")  -- "aXbXcX"
re2.split(",", "one,two,three")          -- {"one", "two", "three"}
re2.quote("a.b*c")                       -- literal-escaped string
re2.valid("[unclosed")                   -- false

-- Object-oriented style - compile once, reuse local p = re2.compile("[a-z]+") p:matches("hello") p:find("123hello456") p:replace("abc123def", "X")


Pattern strings passed to the free functions are cached internally, so calling e.g.
`re2.matches("some.pattern", text)` repeatedly with the same pattern string doesn't
recompile the regex from scratch every time.

## Links

- [LuaMine](/plugins/luamine) (required dependency)
- Documentation
- Source
Партнёрский материал

Сервер для плагина Luamine-re2addon - как у профи

Плагин Luamine-re2addon создан для серверов: на своём сервере вы настраиваете его под себя и решаете, кому играть. Создать сервер с плагином Luamine-re2addon для друзей можно за пару минут - BungeeHost всё уже подготовил.

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

1.21.x

Платформы

Поддерживаемые окружения

Сервер

Ссылки

Создатели

Детали

Лицензия:
Опубликован:3 месяца назад
Обновлён:3 месяца назад
Главная