Class Regexes

java.lang.Object
com.google.errorprone.util.Regexes

public final class Regexes extends Object
Utilities for checks that work with regexes.
  • Method Details

    • convertRegexToLiteral

      public static Optional<String> convertRegexToLiteral(String s)
      If the given regexes matches exactly one string, returns that string. Otherwise returns null. This can be used to identify arguments to e.g. String.replaceAll that don't need to be regexes.