[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  New feature - named wildcards
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

New feature - named wildcards

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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&lt;who&gt;.*) tells you '(?P&lt;what&gt;.*)'"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>%&lt;who&gt; just told you %&lt;what&gt;</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
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] 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.


5,233 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]