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

 Related 
Contents
See also:
  CaseSens
  Pos
  Regular Expressions
  Regular Expression Options
  RegReplace
String Library
  Pos
  SubStr
  Len
  Replace
  Left
  Right
  Upper
  Lower
  Proper
  IntVal
  FloatVal
  Format
  Insert
  Delete
  Concat
  LeftBack
  RightBack
  Word
  NumWord
  DeleteNWord
  Begins
  Ends
  ASCII
  IsInt
  IsFloat
  RepeatStr
  Trim
  LTrim
  RTrim
  Explode
  Join
  Match
  RegReplace
  StripTags
  EncodeHTML
  DecodeHTML
  Reverse
  Compare
  HexStr
  HexVal
  QuoteSQL
  EncodeURL
  DecodeURL
  ExtractFileName
  ExtractFileExt
  ExtractPath
  Pad
  PadRight
  Center
  Soundex
  Wordwrap
  DecimalSeparator
  CaseSens
  QuoteChar
  Regular Expression Options
  Regular Expressions
  Split
  ExpandTabs
  md5
  ForceFileExt
  LoadFromFile
  SaveToFile
  cr
  lf
  crlf
Related Links:
  Match
  Documentation Viewer
Match [[Str.Match]] 
NOTE: This Design document is subject to change at any time.
Match( RegExp: WideString; Source: WideString; var Matches: IzCollection; [Options: WideString; Start: Integer]): Integer


Tries to match the regular expression RegExp with the Source string. If there is a match, the position of the match is returned, and any substrings captured by the regular expression are stored in the Matches collection. If there is no match, then a zero is returned. The Options argument allows you to control items like case sensitivity. See the Options list for more details. The match is performed beginning at the Start position of the Source string.

Matches is a zero-based collection. The Matches[0] value returns the entire portion of Source that matched the pattern. Matches[1]..Matches[N] contain the subpatterns from RegExp that were surrounded with parenthesis.

If Options is omitted, no options are applied. If Start is omitted, the match starts at the beginning of the Source string.

zApp saves the previous compiled regular expression so if you call Match with the same pattern but different source strings or start positions, the second execution will be faster than the first.

For example:

str.Match("(\d+) gold", "123 gold", Matches, "", 1)

returns a value of 1 since it matches the beginning of the string. And the collection Matches has two items stored in it: Matches[0] is "123 gold" and Matches[1] is "123".

JScript Note: JScript does not support by-reference arguments, so you cannot access Matches within JScript and should not use this function.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net