Creates a new ReplaceSequence
with the first pattern to be replaced with the specified replaceWith
parameter.
Creates a new ReplaceSequence
with the first pattern to be replaced with the specified replaceWith
parameter.
The regex Pattern pattern
String
for the first replacement
The String
to replace matches of the specified pattern
a new instance
Creates a new ReplaceSequence
with the first pattern to be replaced with an empty String
Creates a new ReplaceSequence
with the first pattern to be replaced with an empty String
The regex Pattern pattern
string for the first replacement
a new instance
Wraps the usage of making multiple string replacements in an ordered sequence. For Example... instead of doing this over and over:
You can use aReplaceSequence
like this:Internally, an ordered list of
Matcher
s and its associated replacement is built as the#append
method is called.Each matcher is
Matcher#reset(CharSequence) reset
with the input specified in the#replaceAll(String)
method. Use of this class can improve performance if the sequence of replacements is intended to be used repeatedly throughout the life of an application.This is due to the fact that each
Pattern
is only compiled once and eachMatcher
is only generated once.