Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to parse escaped quotes? #38

Closed
karangarg45 opened this issue Feb 8, 2021 · 3 comments
Closed

Possible to parse escaped quotes? #38

karangarg45 opened this issue Feb 8, 2021 · 3 comments

Comments

@karangarg45
Copy link

The original lucene lib had an issue and a known limitation related to parse the escaped quotes.
thoward/lucene-query-parser.js#1

When i try to do the same in this library, i get some unexpected result(not an error though). Is it also a limitation with this parser too?

Codesandbox example for the same
https://codesandbox.io/s/busy-browser-kzykt?file=/src/index.js

@bripkens
Copy link
Owner

bripkens commented Feb 8, 2021

Hey @karangarg45,

in the code example you did not correctly string escape the quotes.

You use: 'keyword: "some \"random\"" ' whereas it should be 'keyword: "some \\"random\\"" ' (try executing this on the Node.js command line/browser dev tools to test this).

@bripkens bripkens closed this as completed Feb 8, 2021
@karangarg45
Copy link
Author

@bripkens Thanks for the quick response. The string shared by you gives the correct output but now my output contains extra \ charcter.
This is what the output looks like
image

@annanyearian
Copy link

@karangarg45 Your output looks correct to me. The output string contains only the characters some "random".

In term: "some \"random\"" the 2 slashes and 2 outer quotation marks don't exist as part of the string. They are how the terminal/console/browser shows you the data.

"some \"random\"" === 'some "random"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants