RegEx Examples

Unofficial support for the creating and editing of metas.
User avatar
HellsWrath
Site Admin
Posts: 389

RegEx Examples

Post #1 »

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.

Loyola
Posts: 11

Post #2 »

Here are a couple more for Virindi Chat System Pattern recognition, might come in handy.

^\[VI\] <Tell:IIDString:0:VI2:tell:(.*)>(.*)<\\Tell> tells you, ".*"$ --for vi2 tells

^\[VI\] \[<Tell:IIDString:0:VI2:tellch:Vigeneral>Vigeneral<\\Tell>\] <Tell:IIDString:0:VI2:tell:(.*)>(.*)<\\Tell> says, ".*"$ -- for Vigeneral chat

Both of these are patterns to capture all people who speak in vigeneral or send you a vi2 tell(perfect for changing colors)

^\[VI\] <Tell:IIDString:0:VI2:tell:(Char1|Char2|Char3)>(.*)<\\Tell> tells you, ".*"$ ----for tells

^\[VI\] \[<Tell:IIDString:0:VI2:tellch:Vigeneral>Vigeneral<\\Tell>\] <Tell:IIDString:0:VI2:tell:(Char1|Char2|Char3)>(.*)<\\Tell> says, ".*"$ ---for Vigeneral

These would be used if you wanted to change the color (or filter) specific people, you would simple change Char# to a person's virindi account name.


Hope this helps!

User avatar
Trigger9008
Posts: 41

Post #3 »

A list of shortened Regex lines and use descriptions:

((\<Tell:.{9}:[0-9]+:(Char|List|Here)\>.+)|^(\[[A-z]+\] )?You) (think|tells you|says?), \"Your Command Here\"$ -any auth in any channel OR You

^\[Fellowship\] ((\<Tell:.{9}:[0-9]+:(Char|List|Here)\>.+)|You) says?, \"Your Command Here\"$ -any auth in Fellow OR You

^\[Fellowship\].+says?, \"Your Command Here\"$ -anyone in fellow

^\<Tell:.{9}:[0-9]+:(Char|List|Here)\>.+ tells you, \"Your Command Here\"$ -any auth Tell

Please let me know if you find problems!

Updated: Mar 23 2015 1852 EST
~Trigger9008~