Java Matcher quoteReplacement() Method

The quoteReplacement() Method of Matcher class returns a literal replacement String for the specified String. This method can be used with the matcher object and perform replacement operation in the appendReplacement method of matcher class.

Syntax

Parameter

s - The string to be literalized

Returns

A literal string replacement

Since

1.5

Example 1

Output:

java is platform :) 

Example 2

Output:

Exception: Illegal group reference: group index is missing
java$ is secure .java$ is platform