Package groovy.util.regex

# Record Class BalancedGroup.MatchOptions

java.lang.Object
java.lang.Record
groovy.util.regex.BalancedGroup.MatchOptions

Record Components:
  `ignoreRegex` - regex for spans to skip while scanning (e.g. string literals or escape sequences); `null` or blank means ignore nothing. This is the practical counterpart to writing “neither open nor close” character classes in a hand-built .NET balancing pattern.
  `includeEdges` - `true` to keep opening/closing delimiters in `BalancedGroup.getMatchedString()`; `false` to strip them (like .NET's balancing capture of the interval between the subtracted open capture and the close match)

Enclosing class:
  BalancedGroup

public static record BalancedGroup.MatchOptions(String ignoreRegex, boolean includeEdges) extends Record
Options controlling balanced-group matching.

Instances are immutable; use the `with*` methods to derive variants.

Since:
  6.0.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MatchOptions(String ignoreRegex, boolean includeEdges)`
  Creates an instance of a `MatchOptions` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BalancedGroup.MatchOptions`
  `defaults()`
  Default options: nothing ignored, delimiters included.
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `String`
  `ignoreRegex()`
  Returns the value of the `ignoreRegex` record component.
  `boolean`
  `includeEdges()`
  Returns the value of the `includeEdges` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `BalancedGroup.MatchOptions`
  `withIgnoreRegex(String ignoreRegex)`
  Returns a copy with the given ignore regex.
  `BalancedGroup.MatchOptions`
  `withIncludeEdges(boolean includeEdges)`
  Returns a copy with the given edge-inclusion policy.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### MatchOptions

    public MatchOptions(String ignoreRegex, boolean includeEdges)
    Creates an instance of a `MatchOptions` record class.
    Parameters:
      `ignoreRegex` - the value for the `ignoreRegex` record component
      `includeEdges` - the value for the `includeEdges` record component

- ## Method Details

  - ### defaults

    public static BalancedGroup.MatchOptions defaults()
    Default options: nothing ignored, delimiters included.
    Returns:
      the default options

  - ### withIgnoreRegex

    public BalancedGroup.MatchOptions withIgnoreRegex(String ignoreRegex)
    Returns a copy with the given ignore regex.
    Parameters:
      `ignoreRegex` - regex of content to skip, or `null`/blank for none
    Returns:
      a new options instance

  - ### withIncludeEdges

    public BalancedGroup.MatchOptions withIncludeEdges(boolean includeEdges)
    Returns a copy with the given edge-inclusion policy.
    Parameters:
      `includeEdges` - whether matched text keeps opening/closing delimiters
    Returns:
      a new options instance

  - ### toString

    public final String toString()
    Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### hashCode

    public final int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with `Objects::equals(Object,Object)`; primitive components are compared with '=='.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### ignoreRegex

    public String ignoreRegex()
    Returns the value of the `ignoreRegex` record component.
    Returns:
      the value of the `ignoreRegex` record component

  - ### includeEdges

    public boolean includeEdges()
    Returns the value of the `includeEdges` record component.
    Returns:
      the value of the `includeEdges` record component