forked from ralight/sqlite3-pcre
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified to work with MacOS (High Sierra, at least)
- Loading branch information
1 parent
c98da41
commit abe435b
Showing
5 changed files
with
100 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
*.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Sqlite3-pcre: Regex Extension (MacOS Version) | ||
This is sqlite3-pcre, an extension for sqlite3 that uses libpcre to provide the REGEXP() function. | ||
|
||
The original source code was written by Alexey Tourbin and can be found at: | ||
|
||
[http:https://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git](http:https://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git) | ||
|
||
## 2020 UPDATE: | ||
Updated to work with MacOS. Modified the Makefile to compile and install on MacOS, changed C source code to get rid of "no string" error. | ||
|
||
## Usage | ||
```bash | ||
git clone https://github.com/MatthewWolff/sqlite3-pcre | ||
cd sqlite3-pcre | ||
make | ||
make install | ||
``` | ||
|
||
You can then define a command line function to search whatever database you desire—I wanted to search all my iMessages. | ||
```bash | ||
search_messages() { | ||
regex="$@" | ||
database="$HOME/library/messages/chat.db" | ||
use_extension=".load /usr/lib/sqlite3/pcre.so" | ||
query="SELECT text FROM message WHERE text REGEXP '$regex'" | ||
sqlite3 "$database" -cmd "$use_extension" "$query" | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.