Package net.sf.saxon.regex

## Class Operation.OpUnambiguousRepeat

- java.lang.Object
- - net.sf.saxon.regex.Operation
  - - net.sf.saxon.regex.Operation.OpRepeat
    - - net.sf.saxon.regex.Operation.OpUnambiguousRepeat

- Enclosing class:
    Operation

      public static class Operation.OpUnambiguousRepeat
      extends Operation.OpRepeat

  Handle a repetition where there is no ambiguity; if the repeated term is matched in the string, then it cannot match anything other than the repeated term. It is also used when the number of occurrences is fixed. In this situation there will never be any need for backtracking, so there is no need to keep any information to support backtracking, and in addition, there is no distinction between greedy and reluctant matching. This operation is used only for a repeated atom or CharClass, which also means that if the repeated term matches then it can only match in one way; a typical example is the term "A*" in the regex "A*B".

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.sf.saxon.regex.Operation

      `Operation.OpAtom, Operation.OpBackReference, Operation.OpBOL, Operation.OpCapture, Operation.OpCharClass, Operation.OpChoice, Operation.OpEndProgram, Operation.OpEOL, Operation.OpGreedyFixed, Operation.OpNothing, Operation.OpReluctantFixed, Operation.OpRepeat, Operation.OpSequence, Operation.OpTrace, Operation.OpUnambiguousRepeat`

  - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.regex.Operation.OpRepeat

      `max, min, op`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getMatchLength()` | Get the length of the matches returned by this operation if they are fixed-length
    `IntIterator` | `iterateMatches​(REMatcher matcher, int position)` | Get an iterator returning all the matches for this operation
    `int` | `matchesEmptyString()` | Ask whether the regular expression is known, after static analysis, to match a zero-length string
    `Operation` | `optimize​(REProgram program, REFlags flags)` | Optimize the operation

    - ### Methods inherited from class net.sf.saxon.regex.Operation.OpRepeat

      `containsCapturingExpressions, display, getInitialCharacterClass, getMinimumMatchLength`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### matchesEmptyString

          public int matchesEmptyString()

      Description copied from class: `Operation`
      Ask whether the regular expression is known, after static analysis, to match a zero-length string
      Overrides:
        `matchesEmptyString` in class `Operation.OpRepeat`
      Returns:
        a value indicating whether the regex is statically known to match a zero-length string. Specifically:
        - returns `Operation.MATCHES_ZLS_AT_START` if the expression is statically known to match a zero-length string at the start of the supplied input;
        - returns `Operation.MATCHES_ZLS_AT_END` if it is statically known to return a zero-length string at the end of the supplied input;
        - returns `Operation.MATCHES_ZLS_ANYWHERE` if it is statically known to match a zero-length string anywhere in the input.
        - returns `Operation.MATCHES_ZLS_NEVER` if it is statically known that the regex will never match a zero length string.
        Returning 0 means that it is not known statically whether or not the regex will match a zero-length string; this case typically arises when back-references are involved.

    - #### getMatchLength

          public int getMatchLength()

      Description copied from class: `Operation`
      Get the length of the matches returned by this operation if they are fixed-length
      Overrides:
        `getMatchLength` in class `Operation.OpRepeat`
      Returns:
        the length of the matches, or -1 if the length is variable

    - #### optimize

          public Operation optimize​(REProgram program,
                                    REFlags flags)

      Description copied from class: `Operation`
      Optimize the operation
      Overrides:
        `optimize` in class `Operation.OpRepeat`
      Parameters:
        `program` - the program being optimized
        `flags` - the regular expression flags
      Returns:
        the optimized operation

    - #### iterateMatches

          public IntIterator iterateMatches​(REMatcher matcher,
                                            int position)

      Description copied from class: `Operation`
      Get an iterator returning all the matches for this operation
      Overrides:
        `iterateMatches` in class `Operation.OpRepeat`
      Parameters:
        `matcher` - supplies the context for the matching; may be updated with information about captured groups
        `position` - the start position to seek a match
      Returns:
        an iterator returning the endpoints of all matches starting at the supplied position