I have a sqlite table with fields api
and status
.
I want to fetch data using regex using this fields to match
with them.
How can I use regex to fetch data
from sqlite
in nodejs?
similiar question: How do I use regex in a SQLite query?
The given anwer only works in ubuntu and my server has centos which does not support sqlite3-pcre
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0