Package org.approvej.scrub
Class RegexScrubber
java.lang.Object
org.approvej.scrub.RegexScrubber
- Direct Known Subclasses:
DateScrubber,InstantScrubber
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionReplaces each match with "[scrubbed #]" where '#' is the number of the distinct found string. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRegexScrubber(Pattern pattern, Function<Integer, String> replacement) Creates aRegexScrubber.RegexScrubberBuilderwith the given pattern and replacementFunction. -
Method Summary
Modifier and TypeMethodDescriptionstringsMatching(String pattern) Creates aRegexScrubber.RegexScrubberBuilderwith the given pattern.stringsMatching(Pattern pattern) Creates aRegexScrubber.RegexScrubberBuilderwith the given pattern.
-
Field Details
-
NUMBERED_REPLACEMENT
Replaces each match with "[scrubbed #]" where '#' is the number of the distinct found string.E.g.
Hello World!with a pattern of[aeiou]will result in"H[scrubbed 1]ll[scrubbed 2] W[scrubbed 2]rld!"
-
-
Constructor Details
-
RegexScrubber
Creates aRegexScrubber.RegexScrubberBuilderwith the given pattern and replacementFunction.- Parameters:
pattern- the pattern matching the string to be scrubbed asStringreplacement- a function that receives the finding index and returns the replacement string- See Also:
-
-
Method Details
-
stringsMatching
Creates aRegexScrubber.RegexScrubberBuilderwith the given pattern.- Parameters:
pattern- thePatternmatching the strings to be scrubbed- Returns:
- a
RegexScrubber.RegexScrubberBuilderwith the given pattern
-
stringsMatching
Creates aRegexScrubber.RegexScrubberBuilderwith the given pattern.- Parameters:
pattern- the pattern matching the string to be scrubbed asString- Returns:
- a
RegexScrubber.RegexScrubberBuilderwith the given pattern - See Also:
-
apply
-