Package: org.grails.cli.interactive.completers

## [Groovy] Class RegexCompletor

- org.grails.cli.interactive.completers.RegexCompletor

- All Implemented Interfaces and Traits:
    jline.console.completer.Completer

      class RegexCompletor
      extends java.lang.Object

  JLine Completor that accepts a string if it matches a given regular expression pattern.

  Authors:
    Peter Ledbrook
  Since:
    2.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `java.util.regex.Pattern` | `pattern`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `RegexCompletor (java.lang.String pattern)`
    `RegexCompletor (java.util.regex.Pattern pattern)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `int` | `complete(java.lang.String buffer, int cursor, java.util.List candidates)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Property Detail

    - #### java.util.regex.Pattern pattern

  - ### Constructor Detail

    - #### RegexCompletor(java.lang.String pattern)

    - #### RegexCompletor(java.util.regex.Pattern pattern)

  - ### Method Detail

    - #### int complete(java.lang.String buffer, int cursor, java.util.List candidates)

      Check whether the whole buffer matches the configured pattern. If it does, the buffer is added to the `candidates` list (which indicates acceptance of the buffer string) and returns 0, i.e. the start of the buffer. This mimics the behaviour of SimpleCompletor.

      If the buffer doesn't match the configured pattern, this returns -1 and the `candidates` list is left empty.