Match.Result(String) Method

Definition

Returns the expansion of the passed replacement pattern. For example, if the replacement pattern is $1$2, Result(String) returns the concatenation of Groups[1].Value and Groups[2].Value.

public:
 virtual System::String ^ Result(System::String ^ replacement);
public virtual string Result(string replacement);
abstract member Result : string -> string
override this.Result : string -> string
Public Overridable Function Result (replacement As String) As String

Parameters

replacement
String

The replacement pattern to use.

Returns

The expanded version of the replacement parameter.

Exceptions

replacement is null.

Expansion is not allowed for this pattern.

Remarks

Whereas the Replace(String, String) method replaces all matches in an input string with a specified replacement pattern, the Result(String) method replaces a single match with a specified replacement pattern. Because it operates on an individual match, it is also possible to perform processing on the matched string before you call the Result(String) method.

The replacement parameter is a standard regular expression replacement pattern. It can consist of literal characters and regular expression substitutions. For more information, see Substitutions.

Applies to

See also