PatternSearchMatcher (jEdit API Documentation)
Date: 2017-03-18

org.gjt.sp.jedit.search

## Class PatternSearchMatcher

- java.lang.Object
- - org.gjt.sp.jedit.search.SearchMatcher
  - - org.gjt.sp.jedit.search.PatternSearchMatcher

-     public class PatternSearchMatcher
      extends SearchMatcher

  A regular expression string matcher using java.util.regex.
  Since:
    jEdit 4.3pre5
  See Also:
    `Pattern`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.gjt.sp.jedit.search.SearchMatcher

      `SearchMatcher.Match`

  - ### Field Summary

    - ### Fields inherited from class org.gjt.sp.jedit.search.SearchMatcher

      `noWordSep, returnValue, wholeWord`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PatternSearchMatcher(java.util.regex.Pattern re, boolean ignoreCase)` Creates a new regular expression already compiled.
    `PatternSearchMatcher(java.util.regex.Pattern re, boolean ignoreCase, boolean wholeWord)` Creates a new regular expression string matcher.
    `PatternSearchMatcher(java.lang.String search, boolean ignoreCase)` Creates a new regular expression string matcher.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SearchMatcher.Match` | `nextMatch(java.lang.CharSequence text, boolean start, boolean end, boolean firstTime, boolean reverse)` Returns the offset of the first match of the specified text within this matcher.
    `static java.util.regex.Pattern` | `removeNonCapturingGroups(java.util.regex.Pattern re, int flags)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.gjt.sp.jedit.search.SearchMatcher

      `isWholeWord, setNoWordSep`

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

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

- - ### Constructor Detail

    - #### PatternSearchMatcher

          public PatternSearchMatcher(java.lang.String search,
                                      boolean ignoreCase)

      Creates a new regular expression string matcher.
      Parameters:
        `search` - the search pattern
        `ignoreCase` - `true` if you want to ignore case
      Since:
        jEdit 4.3pre5
      See Also:
        `Pattern`

    - #### PatternSearchMatcher

          public PatternSearchMatcher(java.util.regex.Pattern re,
                                      boolean ignoreCase,
                                      boolean wholeWord)

      Creates a new regular expression string matcher.
      Parameters:
        `re` - the compiled regex
        `ignoreCase` - `true` if you want to ignore case
        `wholeWord` - `true` to search for whole word only
      Since:
        jEdit 4.5pre1
      See Also:
        `Pattern`

    - #### PatternSearchMatcher

          public PatternSearchMatcher(java.util.regex.Pattern re,
                                      boolean ignoreCase)

      Creates a new regular expression already compiled.
      Parameters:
        `re` - the compiled regex
        `ignoreCase` - `true` if you want to ignore case
      Since:
        jEdit 4.3pre13
      See Also:
        `Pattern`

  - ### Method Detail

    - #### nextMatch

          public SearchMatcher.Match nextMatch(java.lang.CharSequence text,
                                               boolean start,
                                               boolean end,
                                               boolean firstTime,
                                               boolean reverse)

      Returns the offset of the first match of the specified text within this matcher.

      Reverse regex search is done by searching from the beginning to just prior to the current match, so will be inefficient for large buffers.

      Specified by:
        `nextMatch` in class `SearchMatcher`
      Parameters:
        `text` - The text to search in
        `start` - True if the start of the text is the beginning of a line
        `end` - True if the end of the text is the end of a line
        `firstTime` - If false and the search string matched at the start offset with length zero, automatically find next match
        `reverse` - If true, searching will be performed in a backward direction.
      Returns:
        A `SearchMatcher.Match` object.

    - #### removeNonCapturingGroups

          public static java.util.regex.Pattern removeNonCapturingGroups(java.util.regex.Pattern re,
                                                                         int flags)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`