caub / pg-tsquery

:mag: Parse user input into a valid PostgreSQL tsquery
https://caub.github.io/pg-tsquery
58 stars 8 forks source link

Invalid `tsquery` output #27

Open apoorv-mishra opened 1 month ago

apoorv-mishra commented 1 month ago

Invalid tsquery output given for the following case,

const tsquery = require('pg-tsquery');
console.log(tsquery()("env\\: *")) // env\ – note that `:` and `*` are missing
caub commented 1 month ago

Unfortunately I don't have enough time to work on this, the regexes config https://github.com/caub/pg-tsquery/blob/master/index.js#L56-L64 can probably be adjusted to handle such case

I think adding the backslash \\ in word regex should do it if you expect "env\:" as a result, let us know how it goes please