public static class StringNormalizer.RegexNormalizerRule extends Object implements StringNormalizer.NormalizerRule
StringNormalizer.NormalizerRule
that applies a series of regular expression
substitutions.Constructor and Description |
---|
RegexNormalizerRule(boolean everywhere,
String... patterns)
Create a new regular expression rule using a series of
pattern/replacement pairs.
|
RegexNormalizerRule(String... patterns)
Create a new regular expression rule using a series of
pattern/replacement pairs.
|
Modifier and Type | Method and Description |
---|---|
String |
normalize(String content)
Normalize a string by applying all of this rule's regular
expression pattern/replacement pairs, in order.
|
public RegexNormalizerRule(String... patterns)
myRule = new RegexNormalizerRule( "pattern1", "replacement1", "pattern2", "replacement2", ... // As many as you want );
patterns
- a series of regular expression pattern/replacement
pairs (there must be an even number!)public RegexNormalizerRule(boolean everywhere, String... patterns)
everywhere
- True if all pattern/replacements should be
applied globally (for every match), or false if the replacements
should only be applied to the first match for each pattern.patterns
- a series of regular expression pattern/replacement
pairs (there must be an even number!)public String normalize(String content)
normalize
in interface StringNormalizer.NormalizerRule
content
- The string to transform