COWMODSКаталог модов

Regex Library Datapack

A datapack library that provides a way to match substrings using regular expressions.

91911обновлён 19 июн. 2024 г.
БиблиотекиУтилиты

Описание

This library requires Moxlib to function.

GMDU Regex Library

by Gears and Moxvallix.

Overview

This library provides a simple regular expression parser, working entirely in mcfunction.

Current Features and Metacharacters

CharacterExampleDescription
[][abc]Character set
[^][^abc]Inverted character set
[x-y][A-Z]Character range
()(ab)Group
..Wildcard
|(a|b)Or
^^abcBeginning of string
$xyz$End of string
?ab?Zero or one of the preceding token
*ab*Zero or more of the preceding token
+ab+One or more of the preceding token
\\+Escape following character

If you need help creating your regex pattern, we recommend using RegExr.

Not all features from RegExr are supported in our library, see table above.

Getting Started

This library uses a simple api. The string to match is given in target, and the regex to match with is set in pattern. These are set in the storage, regex:api/match

To run the match, run function regex:api/match.

Example

data modify storage regex:api/match target set value "Hello, World!"
data modify storage regex:api/match pattern set value "[A-Za-z]+"
function regex:api/match
{
  success: 1b,
  output: ["H","e","l","l","o"]
}

Галерея

Regex Library Datapack

Последние версии

Все версии →
release

Regex v0.1.2

0.1.2
19 июн. 2024 г.386Minecraft: 1.21datapack
Скачать
Что нового
## [0.1.2] - 2024-06-19 Update to 1.21 ### Changed - The datapack now requires 1.21.
release

Regex v0.1.1

0.1.1
20 февр. 2023 г.462Minecraft: 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6datapack
Скачать
Что нового
## [0.1.1] - 2023-02-21 Flags and presets ### Added - Escaped presets, including \w and \n - Three flags - parse, process_pattern and process_target ### Fixed - `*` quantifiers breaking the output when they match zero characters
release

Regex v0.1.0

0.1.0
15 февр. 2023 г.71Minecraft: 23w03a, 23w04a, 23w05a, 23w06adatapack
Скачать
Что нового
## [0.1.0] - 2023-02-16 Initial release! ### Added - Basic README, and CHANGELOG - Match function - Regex parser