Skip to content

Quoting a search string containing newlines with extended search syntax doesn't work #696

Closed

Description

@bschlenk

Describe the bug

Searching for an exact match that contains a newline doesn't find any results.

Version

6.6.2

Is this a regression?

No

🔬Minimal Reproduction

const Fuse = require('fuse.js')

const books = [
  {
    "title": "Old Man's War",
    "author": "John Scalzi"
  },
  {
    "title": "The Lock\nArtist",
    "author": "Steve"
  },
  {
    "title": "Artist for Life",
    "author": "Michelangelo"
  },
]

const options = {
  useExtendedSearch: true,
  keys: ['title']
}

const fuse = new Fuse(books, options)

const results = fuse.search(`'"Lock\nArtist"`)
console.log(results)

Additional context

It looks like one possible fix is to add /s to all the multiRegex (like this one) so that the . also includes newlines. I'm okay with sending a PR if this solution sounds okay!

Activity

  1. github-actions commented on Feb 10, 2023

    @github-actions

    This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions