Match

Match CF 1.0, serializable

System.Text.RegularExpressions (system.dll) class

This class is a single match result of a regular expression. As with Capture and Group , Match has no public constructor. It is returned by Regex.Match( ) or as a member of a MatchCollection returned by Regex.Matches( ) . A Match instance contains the groups that have been captured in a GroupCollection returned by Groups . A Match inherits from Group and is equivalent to the zero-indexed group in its GroupCollection (the same as Groups[0] ).

The NextMatch( ) method finds the next match result in the search string, starting at the end of the previous match. This method disregards any zero-width assertions on the tail of an expression and begins explicitly after the position of the last character of the previous result (even an empty result).

The Result( ) method takes a replacement pattern and returns the resulting string based on the current match. A replacement pattern is an expression that uses the group replacement syntax, such as $1 or ${ name } . Result( ) expands the replacement variables corresponding to the captured groups, within its current result, and returns the string.

 public class  Match  : Group {  // Public Static Properties  public static Match  Empty  {get; }  // Public Instance Properties  public virtual GroupCollection  Groups  {get; }  // Public Static Methods  public static Match  Synchronized  (Match   inner   );  // Public Instance Methods  public Match  NextMatch  ( );    public virtual string  Result  (string   replacement   ); } 

Hierarchy

System.Object Capture Group Match

Returned By

MatchCollection.this , Regex.Match( )

Passed To

MatchEvaluator.{BeginInvoke( ) , Invoke( )}



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net