Attach (recommended) or Link to PDF file here:
[NHA-20211231-A-018_before.pdf](https://github.com/mozilla/pdf.js/files/8055863/NHA-20211231-A-018_before.pdf)

Configuration:
- Web browser and its version: Firefox nightly
- Operating system and its version: Windows 11

Steps to reproduce the problem:
1. Search for "a"
2. Some highlighter results are wrong

![image](https://user-images.githubusercontent.com/5641725/153760070-61708a75-524c-4a21-bc1f-7745e9151b97.png)

After investigations some results are shifted because of a bug with "-\n".
true;
  }
  **
   * Determine if the search query constitutes a "whole word", by comparing the
   * firstlast character type with the precedingfollowing character type.
   *
  _isEntireWord(content, startIdx, length) {
    let match = content
      .slice(0, startIdx)
      .match(NOT_DIACRITIC_FROM_END_REG_EXP);
    if (match) {
      const first = content.charCodeAt(startIdx);
      const limit = match[1].charCodeAt(0);
      if (getCharacterType(first) === getCharacterType(limit)) {
        return false;
      }
    }
    match = content
      .slice(startIdx + length)
      .match(NOT_DIACRITIC_FROM_START_REG_EXP);
    if (match) {
      const last = content.charCodeAt(startIdx + length - 1);
      const limit = match[1].charCodeAt(0);
      if (getCharacterType(last) === getCharacterType(limit)) {
        return false;
      }
    }
    return true;
  }
  _calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {
    const matches = [],
      matchesLength = [];
    const diffs = this._pageDiffs[pageIndex];
    let match;
    while ((match = query.exec(pageContent)) !== null) {
      if (
        entireWord &&
        !this._isEntireWord(pageContent, match.index, match[0].length)
      ) {
        continue;
      }
      const [matchPos, matchLen] = getOriginalIndex(
        diffs,
        match.index,
        match[0].length
      );
      if (matchLen) {
        matches.push(matchPos);
        matchesLength.push(matchLen);
      }
    }
    this._pageMatches[pageIndex] = matches;
    this._pageMatchesLength[pageIndex] = matchesLength;
  }
  _convertToRegExpString(query, hasDiacritics) {
    const { matchDiacritics } = this._state;
    let isUnicode = false;
    query = query.replace(
      SPECIAL_CHARS_REG_EXP,
      (
        match,
        p1 
        p2 
        p3 
        p4 
        p5 
      ) => {
        
        
        if (p1) {
          
          return `[ ]*\\${p1}[ ]*`;
        }
        if (p2) {
          
          return `[ ]*${p