Trevixal API
    Preparing search index...

    Function compileSearch

    • Compile the user's query into a global regex.

      Everything the user can type is funnelled through here, including plain text, which is escaped rather than special-cased. One code path means the whole-word and case flags behave identically in both modes.

      Returns the error message instead of throwing: an unfinished pattern like ( is a normal thing to have on screen while typing, not an exception.

      Parameters

      Returns { regex: RegExp } | { error: string }