0

Iam using sqlite in nodejs.So by default sqlite in not permitting regex support.

I had added a external dependency sqlite3-pcre to support regex in sqlite.

How can I use this regex package to fetch data from sqlite in nodejs?

similiar question: How do I use regex in a SQLite query?

The given answer only works in ubuntu and my server has centos which does not support sqlite3-pcre

Abhishek
  • 45
  • 10

1 Answers1

0

This solved my problem in Ubuntu Os:

https://stackoverflow.com/a/8338515/13826483 this solves the problem using terminal but the real problem was how I can implement that in my nodejs project.

pool: {
    afterCreate: (conn, done) => {
        conn.loadExtension(`/usr/lib/sqlite3/pcre.so`, (err: any) => {
            done(err, conn);
        });
    }
}

Like this we can load sqlitepcre each time we initilaises a db object.So that we can use regex in our nodejs project.

Abhishek
  • 45
  • 10