Apply pattern matching to a string field

Visual Studio Team Foundation Server 2013

MATCH Element Syntax Structure

You use the MATCH element to enforce basic pattern matching by defining a pattern that values in String type fields must match.

 Copy imageCopy Code
<MATCH pattern="patternValue" for="userGroupName" not="userGroupName" />

Attributes

You can specify to which users the MATCH rule applies. If you do not define any optional attributes, all valid users and groups in Team Foundation Server must specify a value that matches the pattern.

Attribute

Description

pattern

Required. Enforces basic pattern matching for strings only, and only for strings whose syncnamechanges="false".

Valid values for the patternValue are "A", "N", and "X", which denote the following types of characters:

  • "A" represents an alphabetical character.

  • "N" represents a numeric character.

  • "X" represents any alphanumeric character.

All other values are taken as literals. Minimum length: 1; maximum length: 255.

Pattern value: ^[^\\]*$

Pattern value example: xxxxx.nn.nn

for

Optional. Specifies the name of a user or group in Team Foundation to whom the rule applies. Valid names consist of a string of text that contains between 1 and 255 characters.

Pattern value: ^[^\\]+\\[^\\]+$

Pattern value example: Domain\UserID

not

Optional. Specifies the name of a user or group in Team Foundation to whom the rule does not apply. Valid names consist of a string of text that contains between 1 and 255 characters.

Pattern value: ^[^\\]+\\[^\\]+$

Pattern value example: Domain\UserID

Back to top

Pattern Matching Examples

The following examples illustrate successful and unsuccessful pattern matches for a variety of field uses.

Release Number

Pattern: ANN.NN.NN

Validates

R01.03.04 or V05.08.99

Fails validation

1.3.4 or V5.8.99 or v1.3

A Flexible Identifier

Pattern: XXX-XXX

Validates

001-abc or a00-b02

Fails validation

1-abc or 001.abc

Priority

Pattern: PN

Validates

P1 or P5 or P9

Fails validation

1 or P10

Match tags are case-insensitive. Therefore, "PN" matches both P1 and p1.

Back to top

See Also