Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/main/java/com/google/code/regexp/Matcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public MatchResult toMatchResult() {
* <p>If the match succeeds then more information can be obtained via the
* start, end, and group methods.</p>
*
* @return <tt>true</tt> if, and only if, a subsequence of the input
* @return {@code true} if, and only if, a subsequence of the input
* sequence matches this matcher's pattern
*/
public boolean find() {
Expand Down Expand Up @@ -206,6 +206,25 @@ public Matcher appendReplacement(StringBuffer sb, String replacement) {
return this;
}

/**
* Returns a literal replacement {@code String} for the specified
* {@code String}.
*
* This method produces a {@code String} that will work
* as a literal replacement {@code s} in the
* {@code appendReplacement} method of the {@link Matcher} class.
* The {@code String} produced will match the sequence of characters
* in {@code s} treated as a literal sequence. Slashes ('\') and
* dollar signs ('$') will be given no special meaning.
*
* @param s The string to be literalized
* @return A literal string replacement
* @since 0.2.7
*/
public static String quoteReplacement(String s) {
return java.util.regex.Matcher.quoteReplacement(s);
}

/**
* Implements a terminal append-and-replace step.
*
Expand Down