Matching of Prompt

Posted by Lethethar on Wed 16 Jul 2014 07:11 PM — 4 posts, 18,118 views.

#0
I am trying to match all the varieties of my prompts
I have my prompt matched when out of combat but the second I end up in combat I cannot seem to make it match. <triggers>
<trigger
clipboard_arg="5"
enabled="y"
match="^(\d+)H (\d+)V (\d+)X (\d+)C Exits\:[NWSEUD]+\&gt;$"
regexp="y"
send_to="12"
sequence="100"
>
<send></send>
</trigger>
</triggers>
This works and matches the prompt but when I go into combat my prompt looks like

115H 94V 26542X 6C [Sel:Perfect] [the small black spider:Good] Exits:EW> 

<triggers>
<trigger
enabled="y"
match="^(\d+)H (\d+)V (\d+)X (\d+)C [\w\:[A-Za-z .]+] [(\w +)\:[A-Za-z .]+]Exits\:[NESWUD]+\&gt;$"
match_text_colour="y"
regexp="y"
send_to="12"
sequence="100"
text_colour="8"
>
<send></send>
</trigger>
</triggers>
but this trigger does not match. does not fire ver 4.84
USA Global Moderator #1
FYI: the forum is eating some of your slashes. \[ and \] should be entered as \\[ \\] when you post here. MUSHclient has a feature that makes whatever is in your OS Clipboard forum-safe.

The simple explanation is that (and of course you know this already) your regex is wrong.

I have more luck with

^(\d+)H (\d+)V (\d+)X (\d+)C \[\w+\:[A-Za-z .]+\] \[([\w ]+)\:[A-Za-z .]+\] Exits\:[NESWUD]+\&gt;$


For future regex help, you should try one of the handy online assistants like http://www.regexr.com/
Amended on Wed 16 Jul 2014 07:41 PM by Fiendish
#2
Thank you for the help had been going over it for several hours.
Australia Forum Administrator #3
There is a helper menu inside the trigger edit window:



That can help choose appropriate elements.

Also:

Template:regexp
Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.