RegEx Examples
Posted: February 1st, 2014, 11:37 am
A Regular Expression (RegEx) is the term used to describe a codified method of searching through text.
For a tutorial on RegEx - visit http://www.zytrax.com/tech/web/regex.htm
In Meta, RegEx is used to identify and react on chat messages sent or heard by your client.
The following examples may or may not work as intended, use at your own risk.
Anyone in any chat channel:
^.*().* (say|says|tells you), \"YourCommandHere\"$
Specific names in any chat channel
(^(\[[A-z]+?\] |)You|.*\<Tell:IIDString:.+:(Char2)\>.+\<\\Tell\>) (say|says|tells you), \"!yourcommandhere\"$
Simply replace "Char2" with your name within the () and separate with |
You can not copy/paste this regex, it will not transfer correctly. You must type it
Specific chat channel
\[ChannelNameHere\] (|).* (say|says), \"YourCommandHere\"$
(example: \[Allegiance\] (|).* (say|says), \"YourCommandHere\"$)
Green Messages
Simply place a ^ before the green text in your chat command. The ^ denotes that the string must begin with the first word in the text. This protects you from accidental triggers by other players.
NPC Chat
Create an All: Chat message rule.
Copy/paste the NPC text in to the Chat Message box (excluding "NPCname tells you,")
Create a NOT chat message rule and insert ^.*\s+(say|says|tells you), \".*NPCTextHere.\"$
Thanks to Tacit of MT for help with simplifying these examples.
For a tutorial on RegEx - visit http://www.zytrax.com/tech/web/regex.htm
In Meta, RegEx is used to identify and react on chat messages sent or heard by your client.
The following examples may or may not work as intended, use at your own risk.
Anyone in any chat channel:
^.*().* (say|says|tells you), \"YourCommandHere\"$
Specific names in any chat channel
(^(\[[A-z]+?\] |)You|.*\<Tell:IIDString:.+:(Char2)\>.+\<\\Tell\>) (say|says|tells you), \"!yourcommandhere\"$
Simply replace "Char2" with your name within the () and separate with |
You can not copy/paste this regex, it will not transfer correctly. You must type it
Specific chat channel
\[ChannelNameHere\] (|).* (say|says), \"YourCommandHere\"$
(example: \[Allegiance\] (|).* (say|says), \"YourCommandHere\"$)
Green Messages
Simply place a ^ before the green text in your chat command. The ^ denotes that the string must begin with the first word in the text. This protects you from accidental triggers by other players.
NPC Chat
Create an All: Chat message rule.
Copy/paste the NPC text in to the Chat Message box (excluding "NPCname tells you,")
Create a NOT chat message rule and insert ^.*\s+(say|says|tells you), \".*NPCTextHere.\"$
Thanks to Tacit of MT for help with simplifying these examples.