MatchAttribute.MatchAttribute Constructor

Initializes a new instance of the MatchAttribute class with the specified pattern.

Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in

public MatchAttribute (
	string pattern
public MatchAttribute (
	String pattern
public function MatchAttribute (
	pattern : String
Not applicable.



A string that represents the pattern to match.

Use this constructor to create and initialize a new instance of the MatchAttribute class using the specified pattern.

The following table shows the initial property value for an instance of MatchAttribute.


Initial Value


The value of the pattern parameter.

public class Example_Headers 
	public string Title;
	[MatchAttribute("", Pattern="h1>(.*?)<", IgnoreCase=true)]
	public string H1;

	[MatchAttribute("H2>((([^<,]*),?)+)<", Group=3, Capture=4)] 
	public string Element;

	[MatchAttribute("H2>((([^<,]*),?){2,})<", Group=3, MaxRepeats=0)] 
	public string[] Elements1;

	[MatchAttribute("H2>((([^<,]*),?){2,})<", Group=3, MaxRepeats=1)] 
	public string[] Elements2;

	[MatchAttribute("H3 ([^=]*)=([^>]*)", Group=1)]
	public string Attribute;

	[MatchAttribute("H3 ([^=]*)=([^>]*)", Group=2)]
	public string Value;

public class Example_Headers
    /** @attribute MatchAttribute("TITLE>(.*?)<")
    public String title;

    /** @attribute MatchAttribute("", Pattern = "h1>(.*?)<", IgnoreCase = true)
    public String h1;

    /** @attribute MatchAttribute("H2>((([^<,]*),?)+)<", Group = 3, Capture = 4)
    public String element;

    /** @attribute MatchAttribute("H2>((([^<,]*),?){2,})<", Group = 3, 
        MaxRepeats = 0)
    public String elements1[];

    /** @attribute MatchAttribute("H2>((([^<,]*),?){2,})<", Group = 3, 
        MaxRepeats = 1)
    public String elements2[];

    /** @attribute MatchAttribute("H3 ([^=]*)=([^>]*)", Group = 1)
    public String attribute;

    /** @attribute MatchAttribute("H3 ([^=]*)=([^>]*)", Group = 2)
    public String value;
} //Example_Headers

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions