||Is replaced with
input string: He didn't say, "Stop!"
output string: He didn't say, \"Stop!\"
What are escape and unescape sequences in Java ?
Escape sequences are used to signal an alternative interpretation of a series of characters.
In Java, a character preceded by a backslash (\) is an escape sequence.
The Java compiler takes an escape sequence as one single character that has a special meaning.
In computing and telecommunication, an escape character is a character which invokes an alternative interpretation on
subsequent characters in a character sequence. An escape character is a particular case of metacharacters.
Unescape, it unescapes a characters containing entity escapes to a characters containing the actual Unicode characters corresponding to the escapes.
Unescape Java characters or text is used for converting to plain Java to unescaped Java which helps to show Java characters or text in Java in "pre" tag.
What is an escape character?
An escape character is an alternative version of a symbol. In JAVA, there are some characters that are considered reserved
(such as Newline, Carriage return, Backspace, Form feed, Tab, Double quote and Backslash) and must be replaced by using the character's Java code name or
number, so that the character will be read as a regular character and not a reserved JAVA character.
According to the Java API documentation for regular expressions, there are two ways in which we can escape characters that have special meaning.
In other words, to force them to be treated as ordinary characters.
- Precede a metacharacter with a backslash (\)
- Enclose a metacharacter with \Q and \E.