Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Comparison
  %begins
  %ends
  %len
  %pos
  %regex
  Comparison
Function Reference
  %abs
  %additem
  %addkey
  %alarm
  %alias
  %ansi
  %array
  %arrget
  %arrhigh
  %arrset
  %ascii
  %average
  %begins
  %bitand
  %bitnot
  %bitor
  %bitset
  %bitshift
  %bittest
  %bitxor
  %btncol
  %btnenable
  %btnimage
  %case
  %char
  %charcomment
  %charnotes
  %class
  %clip
  %color
  %colorname
  %colorsyntax
  %comactive
  %comcreate
  %comget
  %comset
  %concat
  %copy
  %count
  %countlist
  %crtonl
  %db
  %dbget
  %dbitems
  %dbkey
  %dbkeys
  %dblist
  %dbmax
  %dbmin
  %dbvalues
  %dde
  %ddeclose
  %ddemacro
  %ddeopen
  %ddepoke
  %defined
  %delete
  %delitem
  %delkey
  %delnitem
  %destroom
  %dice
  %diceavg
  %dicedev
  %dicemax
  %dicemin
  %doorname
  %dups
  %ends
  %eval
  %exec
  %exp
  %expand
  %expanddb
  %expandlist
  %filesize
  %find
  %float
  %format
  %getglobal
  %grep
  %gsl
  %handle
  %hexcolor
  %hexnum
  %hexstr
  %htmldecode
  %htmlencode
  %iconstate
  %if
  %insert
  %int
  %inwalk
  %isfloat
  %iskey
  %ismember
  %isnumber
  %isvalue
  %item
  %json
  %lastdir
  %left
  %leftback
  %len
  %line
  %list
  %literal
  %look
  %lower
  %mapfilter
  %maplocked
  %mapquery
  %mapvnum
  %match
  %max
  %mcp
  %min
  %mod
  %mss
  %nextdir
  %nltocr
  %norm
  %null
  %number
  %numbuttons
  %numitems
  %numkeys
  %numparam
  %numrec
  %numrooms
  %numwords
  %numzones
  %packages
  %param
  %params
  %parsemode
  %parsenumbers
  %pat
  %pathcompress
  %pathexpand
  %pathfrom
  %pathreverse
  %pick
  %pop
  %portal
  %portalenabled
  %pos
  %pref
  %priority
  %prompt
  %proper
  %push
  %query
  %quote
  %random
  %read
  %ref
  %regex
  %remove
  %repeat
  %replace
  %replaceitem
  %reversedir
  %rgb
  %right
  %rightback
  %roomcol
  %roomcom
  %roomcontents
  %roomcost
  %roomdesc
  %roomexit
  %roomflags
  %roomid
  %roomint
  %roomkey
  %roomkind
  %roomlink
  %roomload
  %roommode
  %roomname
  %roomnote
  %roomnum
  %roomportal
  %roomvnum
  %roomzone
  %round
  %section
  %setglobal
  %sort
  %sql
  %sqldb
  %sqrt
  %state
  %stdev
  %string
  %stripansi
  %stripq
  %subchar
  %subregex
  %sum
  %switch
  %threadid
  %threadname
  %time
  %trigger
  %trim
  %trimleft
  %trimright
  %upper
  %url
  %vartype
  %viewrec
  %walk
  %walkactive
  %walkconfirm
  %walkmode
  %walkroom
  %window
  %word
  %write
  %yesno
  %zonename
  %zonenum
  %zonevnum
Related Links:
  %regex
  %subregex
  Comparison
%match [[cmud_%match]] 
match

Syntax: %match(s,pattern,var1,var2,...varN,varN+1)
Related:
#TRIGGER, %subregex, %regex

test to see if string s matches the given Pattern. If it matches, the position of the match in the string is returned (starting with 1). If it doesn't match, zero is returned. The optional VarN arguments contain the names of variables to store any captured subpatterns (subpatterns surrounded by parenthesis). The additional VarN+1 variable name can be specified to hold the length of the matched pattern.

The ($localvar:wildcard) syntax detailed here won't work in %match. You can use a local variable name instead of a normal variable - %match will implicitly declare the local variables before giving them values.

Examples:

#SHOW %match("Zugg says Hi","(%w) says (*)",Name,Message,X)
displays 1 and sets the @Name variable to "Zugg", the @Message variable to "Hi" and the @X variable to 12.

#SHOW %match("Zugg says hi","(%w) says (*)",$Name,$Message,$X)
The above example using local variables.

 User comments 
Arminas: Mon Jan 25, 2010 3:19 am    

Here is an example I whipped up for someone in the forums

A case sensitive match.

This uses in-line regex.

Code:
#print {%match("A Thri-Kreen","%/(?-i)/%A Thri-Kreen")}
#print {%match("A ThRi-Kreen","%/(?-i)/%A Thri-Kreen")}
Viewer Comments [1 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net