java.lang.Object
ai.attackframework.tools.burp.utils.Regex

public final class Regex extends Object
Centralized helpers for regex compilation and flag derivation.

Keeping flag logic in one place avoids drift between UI components and utilities.

  • Method Summary

    Modifier and Type
    Method
    Description
    static Pattern
    compile(String pattern, boolean caseSensitive, boolean multiline)
    Compile a pattern with flags derived from the provided toggles.
    static Pattern
    compileOrNull(String pattern, boolean caseSensitive, boolean multiline)
    Compile a pattern or return null if invalid.
    static int
    flags(boolean caseSensitive, boolean multiline)
    Derive Pattern flags from UI toggles.
    static boolean
    isValid(String pattern, boolean caseSensitive, boolean multiline)
    Returns whether the supplied pattern compiles with the derived flags.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • flags

      public static int flags(boolean caseSensitive, boolean multiline)
      Derive Pattern flags from UI toggles.

      Parameters:
      caseSensitive - whether matching is case-sensitive
      multiline - whether Pattern.MULTILINE should be applied
      Returns:
      integer bitmask for Pattern.compile(String, int)
    • compile

      public static Pattern compile(String pattern, boolean caseSensitive, boolean multiline)
      Compile a pattern with flags derived from the provided toggles.

      Parameters:
      pattern - the regex pattern text
      caseSensitive - whether the match is case-sensitive
      multiline - whether Pattern.MULTILINE should be applied
      Returns:
      compiled Pattern
      Throws:
      PatternSyntaxException - if the pattern is invalid
    • isValid

      public static boolean isValid(String pattern, boolean caseSensitive, boolean multiline)
      Returns whether the supplied pattern compiles with the derived flags.

      This is a convenience for UI validation paths that should not rely on exception-driven control flow while the user is typing.

      Parameters:
      pattern - the pattern text (may be null)
      caseSensitive - whether the match is case-sensitive
      multiline - whether Pattern.MULTILINE should be applied
      Returns:
      true if compile(String, boolean, boolean) succeeds; false otherwise
    • compileOrNull

      public static Pattern compileOrNull(String pattern, boolean caseSensitive, boolean multiline)
      Compile a pattern or return null if invalid.

      Parameters:
      pattern - the pattern text (may be null)
      caseSensitive - whether the match is case-sensitive
      multiline - whether Pattern.MULTILINE should be applied
      Returns:
      compiled Pattern or null if invalid