Object with methods useful for performing a search and highlighting the matches.

Hierarchy

Properties

Methods

Properties

container: HTMLDivElement

Container that all the search results are appended to.

matches: [number, number][]

Array of positions of all the matches.

regex: RegExp

Current regex used for searching.

Methods

  • Unhides the search container and highlights all matches of the specified string in the editor.

    Parameters

    • str: string

      String to search for.

    • Optional caseSensitive: boolean

      Whether or not the search is case sensetive.

    • Optional wholeWord: boolean

      Whether or not matches must be surrounded by word boundries.

    • Optional useRegExp: boolean

      If true, special characters won't be escaped when creating the RegExp.

    • Optional selection: [number, number]

      Boundries to search between. If excluded, all the code is searched.

    • Optional filter: SearchFilter

      A function called for each match with the start and end positions of the match. If it returns false, the match won't be included.

    • Optional wholeWordBoundry: RegExp

      Pattern controlling the behavior of whole word search. Best left undefined unless you know what you're doing. Does nothing if wholeWord isn't set to true. Defaults to /[_\p{N}\p{L}]{2}/u.

    Returns string | void

    An error message if the RegExp was invalid.

Generated using TypeDoc