NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Regex.Replace (String, String, String)

[Visual Basic]
Overloads Public Shared Function Replace( _
   ByVal input As String, _
   ByVal pattern As String, _
   ByVal replacement As String _
) As String
[C#]
public static string Replace(
   string input,
   string pattern,
   string replacement
);
[C++]
public: static String* Replace(
   String* input,
   String* pattern,
   String* replacement
);
[JScript]
public static function Replace(
   input : String,
   pattern : String,
   replacement : String
) : String;

Parameters

input
The string to be modified.
pattern
[To be supplied.]
replacement
[To be supplied.]

Return Value

The modified character string.

Remarks

Substitutions are allowed only within a replacement pattern. For similar functionality within a regular expression, use a backreference (e.g.,\1- see below).

Character escapes and substitutions are the only special constructs recognized in a replacement pattern. All the syntactic constructs described below this point are allowed in regular expressions only and not recognized in replacement patterns. For example, the replacement pattern a*${foo}b inserts the string "a*" followed by the substring matched by the "foo" capturing group, if any, followed by the string "b". The * character is not recognized as a metacharacter within a replacement pattern. Similarly, $-patterns are not recognized within a regular expression matching pattern. Within a regular expression, $ means "end of string".

$123- Substitute the last substring matched by group number 123 (decimal).

${name) Substitute the last substring matched by a (?<name>) group.

See Also

Regex Class | Regex Members | System.Text.RegularExpressions Namespace | Regex.Replace Overload List