Regex.Unescape Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Unescapes any escaped characters in the input string.

Namespace:  System.Text.RegularExpressions
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Shared Function Unescape ( _
    str As String _
) As String
public static string Unescape(
    string str
)

Parameters

  • str
    Type: System.String
    The input string containing the text to convert.

Return Value

Type: System.String
A string of characters with any escaped characters converted to their unescaped form.

Exceptions

Exception Condition
ArgumentNullException

str is nulla null reference (Nothing in Visual Basic).

Remarks

As an example, Unescape replaces \x61 with a and \n with a new-line character (ASCII 10). Unescape reverses the transformation done by Escape. (Of course, Escape cannot perfectly reverse Unescape because it cannot deduce from an unescaped string which characters may have been previously escaped.)

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.