-
Notifications
You must be signed in to change notification settings - Fork 17
Action REGEX
fromgate edited this page Jun 5, 2017
·
4 revisions
This action is used when you need to pull out point data from the text
REGEX <input> <regex> [prefix]
Element | Possible values | Description |
---|---|---|
<input> |
input:<Text> |
Text to be filtered. The text should be indicated in curly brackets, preferably. |
<regex> |
regex:<RegExp>} |
Filter (regular expression). |
<prefix> |
prefix<Prefix> |
Prefix added to temporary placeholders. It is necessary that you can use several REGEX actions in one activator. |
Placeholder | Description |
---|---|
%[prefix]groupNM% %[prefix]group:N:M% %[prefix]group_N_M%
|
The result of the action of the REGEX action. N is the sequence number of occurrences in the text (0 ... N) , M - the ordinal number of the elements of the group (0 ... M) . |
- We will display the coordinates of the mob in separate variables, when the player clicks on it with the right mouse button.
MOB_CLICK:
mcl_regex:
mob-type: zombie
actions:
- MESSAGE=%moblocation%
- REGEX=input:{%moblocation%} regex:{[^,]+}
- 'MESSAGE=world: %group00%'
- 'MESSAGE=x: %group10%'
- 'MESSAGE=y: %group20%'
- 'MESSAGE=z: %group30%'
- 'MESSAGE=alfa: %group40%'
- 'MESSAGE=beta: %group50%'
- We display a filtered message: The player enters the text: $$Hello world! The chat appears: Hello World!
MESSAGE:
msg_regex:
mask: '$$'
type: START
source: CHAT_INPUT
actions:
- CANCEL_EVENT=true
- 'REGEX=input:{%message%} regex:{(\$\$)(.*)}'
- 'BROADCAST=%player_name% : %group02%'
- Applying several REGEX actions in one activator:
Suppose there is a text:
$$Hello world! *My coordinates are: world, 100,90, -124,175.3,25.23
And we need from the text to get Hello world!, and then coordinates world,100,90,-124,175.3,25.23 in separate variables.
MESSAGE:
msg_multi_regex:
mask: $$
type: START
source: CHAT_INPUT
actions:
- CANCEL_EVENT=true
- REGEX=input:{%message%} regex:{(\$\$)(.*)\s(\*)(.*):\s(.*)}
- 'BROADCAST=%player_name% : %group02%'
- REGEX=input:{%group05%} regex:{[^,]+} prefix:my_2_
- 'MESSAGE=world: %my_2_group00%'
- 'MESSAGE=x: %my_2_group10%'
- 'MESSAGE=y: %my_2_group20%'
- 'MESSAGE=z: %my_2_group30%'
- 'MESSAGE=alfa: %my_2_group40%'
- 'MESSAGE=beta: %my_2_group50%'
Links:
Download | Support | Twitter | VK | MinecraftMain Blog
© 2017, fromgate
http://reactions.fromgate.me
http://reactions.fromgate.ru
- Commands and Permission
- Activators
- Flags
- Actions
- Timers
- Menus
- Data formats
- Configuration
- Команды и пермишены
- Активаторы
- Флаги
- Действия
- Таймеры
- Меню
- Форматы данных
- Конфигурация