Export (0) Print
Expand All

Regex.Replace Method (String, String, String, RegexOptions)

.NET Framework 1.1

Replaces all occurrences of a pattern defined by a specified regular expression with a specified replacement character string, starting at the first character in the input string. Options can be specified to modify matching behavior.

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

Parameters

input
The string to modify.
pattern
The regular expression pattern to match.
replacement
The replacement string.
options
A bitwise OR combination of RegexOption enumeration values.

Return Value

The modified string.

Remarks

The static Replace methods are equivalent to constructing a Regex object with the specified regular expression pattern and calling the instance method Replace. The static methods are provided to allow an isolated, single use of a regular expression without explicitly creating a Regex object.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

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

Show:
© 2014 Microsoft