Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ New feature - named wildcards
|
New feature - named wildcards
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Sat 24 Apr 2004 04:00 AM (UTC) Amended on Mon 26 Apr 2004 04:48 AM (UTC) by Nick Gammon
|
| Message
| 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:
- 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>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 24 Apr 2004 05:03 AM (UTC) |
| Message
| | If anyone wants more than 100 wildcards, now is the time to speak up. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #2 on Sat 24 Apr 2004 05:38 AM (UTC) |
| Message
| | 100 [named wildcards] total? or 100 per trigger/alias? |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 24 Apr 2004 05:51 AM (UTC) |
| Message
| | Per trigger/alias. In other words, the internal memory that used to store 10 now stores 100 (for each one). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sat 24 Apr 2004 05:57 AM (UTC) |
| Message
| | After looking at the code it seems that there is no real reason for a limit of 100, so I have increased it to 1000. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Poromenos
Greece (1,037 posts) Bio
|
| Date
| Reply #5 on Sat 24 Apr 2004 11:40 AM (UTC) |
| Message
| | Me like. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Mon 26 Apr 2004 02:38 AM (UTC) |
| Message
| | You can now play with named wildcards in version 3.48, which has just been released. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
20,049 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top