Appendix D - Using Pattern Matching Syntax for Realm Replacement

On This Page

Examples: Remote Access Policy Attributes
Examples: RADIUS Realm Name Replacement

Windows 2000 supports the use of the pattern matching syntax that is widely used in UNIX environments. You can use this syntax to specify the conditions of remote access policy attributes and RADIUS realms. Table 6 describes the special characters that you can use and includes examples.

Table 6 - Special Characters for Pattern Matching Syntax

Character

Description

\

Marks the next character as special.

For example, /n/ matches the character "n". The sequence /\n/ matches a line feed or newline character.

^

Matches the beginning of input or line.

$

Matches the end of input or line.

*

Matches the preceding character zero or more times.

For example, /zo*/ matches either "z" or "zoo."

+

Matches the preceding character one or more times.

For example, /zo+/ matches "zoo" but not "z."

?

Matches the preceding character zero or one time.

For example, /a?ve?/ matches the "ve" in "never."

.

Matches any single character except a newline character.

(pattern)

Matches a pattern and remembers the match.

For example, use "\(" or "\)" to match parentheses characters ( ).

x|y

Matches either x or y.

For example, /z|food?/ matches "zoo" or "food."

{n}

Matches exactly n times (n is a nonnegative integer).

For example, /o{2}/ does not match the "o" in "Bob," but matches the first two o's in "foooood."

{n,}

Matches at least n times (n is a nonnegative integer).

For example, /o{2,}/ does not match the "o" in "Bob" but matches all the o's in "foooood." /o{1,}/ is equivalent to /o+/.

{n,m}

Matches at least n and at most m times (m and n are nonnegative integers).

For example, /o{1,3}/ matches the first three o's in "fooooood."

[xyz]

A character set. Matches any one of the enclosed characters.

For example, /[abc]/ matches the "a" in "plain."

[^xyz]

A negative character set. Matches any character not enclosed.

For example, /[^abc]/ matches the "p" in "plain."

\b

Matches a word boundary, such as a space.

For example, /ea*r\b/ matches the "er" in "never early."

\B

Matches a nonword boundary.

For example, /ea*r\B/ matches the "ear" in "never early."

\d

Matches a digit character (equivalent to [0-9]).

\D

Matches a nondigit character (equivalent to [^0-9]).

\f

Matches a form-feed character.

\n

Matches a line feed character.

\r

Matches a carriage return character.

\s

Matches any white space including space, tab, form-feed, and so on. Equivalent to [ \f\n\r\t\v].

\S

Matches any non-white-space character (equivalent to [^ \f\n\r\t\v]).

\t

Matches a tab character.

\v

Matches a vertical tab character.

\w

Matches any word character including underscore (equivalent to [A-Za-z0-9_]).

\W

Matches any nonword character excluding an underscore (equivalent to [^A-Za-z0-9_]).

\num

?num, where num is a positive integer. A reference back to remembered matches. \1 replaces what is stored in the first remembered match. This option can be used only in the Replace text box when configuring realms with Internet Authentication Service.

/n/

?n, where n is an octal, hexadecimal, or decimal escape value. Allows embedding of ASCII codes into regular expressions.

Examples: Remote Access Policy Attributes

The following examples describe the use of the pattern-matching syntax to specify remote access policy attributes:

  • To specify all phone numbers within a fixed area code:

    For example, to specify all numbers in the 899 area code, the syntax is 899.*

  • To specify a range of IP addresses:

    For example, to specify all IP addresses that begin with 192.168.1, the syntax is 192\.168\.1\..+

Examples: RADIUS Realm Name Replacement

The following examples describe the use of the pattern matching syntax to replace realm names in IAS properties, on the Realms tab, in Find and Replace:

  • To remove the realm portion of the user name:

    In the outsourced dial scenario, the Internet service provider (ISP) might require a realm to route the authentication request to the Internet Authentication Service (IAS) server. Windows 2000 might not recognize the realm, which should be removed (by leaving Replace blank) before authenticating the user.

    Find: @microsoft\\.com

    Replace:

  • To replace user@domain.microsoft.com with domain.microsoft.com\user:

    Find: (.*)@(.*)

    Replace: $2\$1

  • To replace domain\user with specific_domain\user

    Find: {.*}\\{.*}

    Replace: specific_domain\\$2

  • To replace user with user@specific_domain

    Find: $

    Replace: @specific\_domain

For information on how to configure realm replacement in IAS, see Windows 2000 Server Help.