Class StringNormalizer.RegexNormalizerRule

java.lang.Object
student.testingsupport.StringNormalizer.NormalizerRule
student.testingsupport.StringNormalizer.RegexNormalizerRule
Direct Known Subclasses:
NormalizerRuleIgnoreLeadingNewlines, NormalizerRuleTrailingColonPerLine, NormalizerRuleTrailingSpacePerLine
Enclosing class:
StringNormalizer

public static class StringNormalizer.RegexNormalizerRule extends StringNormalizer.NormalizerRule
A highly reusable concrete implementation of StringNormalizer.NormalizerRule that applies a series of regular expression substitutions.
  • Constructor Details

    • RegexNormalizerRule

      public RegexNormalizerRule(String displayName, String... patterns)
      Create a new regular expression rule using a series of pattern/replacement pairs. Each pattern/replacement will be applied globally (all matches that can be found). If multiple patterns are given, they will be applied in the order given. Use this form:
       myRule = new RegexNormalizerRule(
           "pattern1", "replacement1",
           "pattern2", "replacement2",
           ... // As many as you want
       );
       
      Parameters:
      patterns - a series of regular expression pattern/replacement pairs (there must be an even number!)
    • RegexNormalizerRule

      public RegexNormalizerRule(String displayName, boolean everywhere, String... patterns)
      Create a new regular expression rule using a series of pattern/replacement pairs.
      Parameters:
      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!)
  • Method Details