In the process of mucking around with multi-line triggers I am adding another cool new feature.
As anyone who has written a lengthy regular expression would know, it can get tedious to keep track of which wildcard is which, and even more tedious if you need to add another to the front, which throws out the count of all the others.
MUSHclient version 3.48 introduces named wildcards. They work like this:
Also, the number of wildcards has been increased from 9 (plus the "overall" match) to 100.
[EDIT] Increased now to 1,000, see further posts.
You can also use the new syntax to access higher numbered wildcards, eg.
You see %<48> here.
That would enter the value for the 48th wildcard.
Here is an example trigger:
To make the above easier to read, it is:
As anyone who has written a lengthy regular expression would know, it can get tedious to keep track of which wildcard is which, and even more tedious if you need to add another to the front, which throws out the count of all the others.
MUSHclient version 3.48 introduces named wildcards. They work like this:
- When setting up a regular expression you can optionally name each wildcard. This looks like this: Inside the brackets which indicate the wildcard you put ?P<name>, eg.
(?P<hp>.*)
This would name the .* as wildcard "hp".
- When sending the expanded text you can use a named wildcard sequence. You do that with %<name> (instead of %1 to %9). For example to access the hp in the example above:
You have %<hp> hit points.
Also, the number of wildcards has been increased from 9 (plus the "overall" match) to 100.
[EDIT] Increased now to 1,000, see further posts.
You can also use the new syntax to access higher numbered wildcards, eg.
You see %<48> here.
That would enter the value for the 48th wildcard.
Here is an example trigger:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="(?P<who>.*) tells you '(?P<what>.*)'"
regexp="y"
send_to="2"
sequence="100"
>
<send>%<who> just told you %<what></send>
</trigger>
</triggers>
To make the above easier to read, it is:
Match: (?P<who>.*) tells you '(?P<what>.*)'
Send: %<who> just told you %<what>