Wildcards

From Scriptwiki
Jump to: navigation, search

Wildcard characters is the name given to the special meta characters *, &, and ?. These characters are used to "match" strings of text without knowing exactly what will be said.

The characters are as follows:

  • * - Matches anything. From nothing at all, to one letter, to one word, to several words.
  • & - Matches one word. Does not include the space
  •  ? - Matches one letter (or other character such as a number or a special symbol)

Using Wild Cards in Events

Wild cards in mIRC are used most often in events, such as the on text event. The on text event's syntax is as follows:

on <level>:TEXT:<matchtext>:<*><?><#[,#]>:<commands>

(For more information on this event, see the on text event page, as it will not be covered in detail here.)

This event 'triggers' when someone types a line that matches "matchtext". By default, matchtext is a wildcard string. Common uses would be:

  •  !help - No wildcard characters. Matches ONLY the word "!help." will NOT match "!help topics"
  •  !help & - The & (word) matching character. Matches !help <anyword>. The word is required. Will NOT match "!help topics please"
  •  !help* - The * operator matches anything (and nothing). This format will match !help by itself, since * can match nothing. It will also match !helpmeplease or !help me please. It will NOT match ...!help because the * operator only follows !help.
  •  ?help - The ? operator here matches any character. So it will match "!help" "^help" "&help" etc etc. It will NOT match "help" by itself, or "!help please"


More Examples

; Matches !join #anything, for joining channels. Note this will also match !join #channel somethingelse
!join #*
; Matches !join <anything>. Note while this will match !join #foo, it will also match !join notachannel. It will not match !join #channel somethingelse
!join &
; Matches !join #anything. Unlike the use of the * operator, this will NOT match !join #channel somethingelse. It will also match @join #anything, *join #anything, etc.
?join #&

See Also

  • iswm - using wild cards in If statements