From WikiChip
Difference between revisions of "mirc/wildcard"
< mirc

(Created page with "Wildcard characters are special characters that are interpreted when comparing text. There are three meaningful wildcard characters: * ? - matches a single character * * - ma...")
 
Line 11: Line 11:
  
 
"test &" matches "test this" or "test that"
 
"test &" matches "test this" or "test that"
 +
 
"test &his" matches only "test &his"
 
"test &his" matches only "test &his"
 +
 
"test thi&" matches only "test thi&"
 
"test thi&" matches only "test thi&"
 +
 
"test th&s" matches only "test th&s"
 
"test th&s" matches only "test th&s"
 +
 
"test " doesn't match "test $chr(32)"
 
"test " doesn't match "test $chr(32)"
  

Revision as of 19:05, 21 September 2014

Wildcard characters are special characters that are interpreted when comparing text.

There are three meaningful wildcard characters:

  •  ? - matches a single character
  • * - matches everything (including nothing)
  • & - matches a whole word if used alone

For example the expression "t*s a *?t" matchtes the string "this is a text"

If & is not used alone it matches the plain text '&' character. It also doesn't match $chr(32)

"test &" matches "test this" or "test that"

"test &his" matches only "test &his"

"test thi&" matches only "test thi&"

"test th&s" matches only "test th&s"

"test " doesn't match "test $chr(32)"

Be careful when using the & wildcard character inside /if or $iif, it could be interpreted as the & bitwise operator:

if (test & iswm test this)

is not true because & is used as the bitwise operator, you can use $eval() to force mIRC to read the parameter the way you want:

if ($(test &) iswm test this)

If you need to use any of these special characters as plain text in an expression where they are taken as special (not always for &), you can try to use a regular expression instead.