You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+91-14Lines changed: 91 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,35 @@
1
1
# sqlite-regex
2
2
3
-
A fast and performant SQLite extension for regular expressions.
3
+
A fast and performant SQLite extension for regular expressions. Based on [`sqlite-loadable-rs`](https://github.com/asg017/sqlite-loadable-rs), and the [regex crate](https://crates.io/crates/regex).
4
4
5
-
See [`sqlite-loadable-rs`](https://github.com/asg017/sqlite-loadable-rs), the framework that makes this extension possible.
5
+
See [_Introducing sqlite-regex: The fastest Regular Expression Extension for SQLite_](https://observablehq.com/@asg017/introducing-sqlite-regex) (Jan 2023) for more details!
6
6
7
-
## WORK IN PROGRESS
7
+
If your company or organization finds this library useful, consider [supporting my work](#supporting)!
8
8
9
-
This extension isn't 100% complete yet, but hoping to release in the next 1-2 weeks! A sneak peek at what to expect:
9
+

10
10
11
-
### The fastest `REGEXP()` implementation in SQLite
11
+
##Usage
12
12
13
-
I don't have a fancy benchmark screenshot yet, but in my Mac, I get ~50% faster results with the `regexp()` in `sqlite-regex` over the "official" [regexp.c](https://github.com/sqlite/sqlite/blob/master/ext/misc/regexp.c) SQLite extension.
14
-
15
-
### More regex utilities
13
+
```sql
14
+
.load ./regex0
15
+
select'foo' matches 'f';
16
16
17
-
Very rarely does `regexp` cover all your regular expression needs. `sqlite-regex` also includes support for many other regex operations, such as:
See [`docs.md`](./docs.md) for a full API reference.
93
+
94
+
## Installing
95
+
96
+
The [Releases page](https://github.com/asg017/sqlite-regex/releases) contains pre-built binaries for Linux x86_64, MacOS, and Windows.
97
+
98
+
### As a loadable extension
99
+
100
+
If you want to use `sqlite-regex` as a [Runtime-loadable extension](https://www.sqlite.org/loadext.html), Download the `regex0.dylib` (for MacOS), `regex0.so` (Linux), or `regex0.dll` (Windows) file from a release and load it into your SQLite environment.
101
+
102
+
> **Note:**
103
+
> The `0` in the filename (`regex0.dylib`/ `regex0.so`/`regex0.dll`) denotes the major version of `sqlite-regex`. Currently `sqlite-regex` is pre v1, so expect breaking changes in future versions.
104
+
105
+
For example, if you are using the [SQLite CLI](https://www.sqlite.org/cli.html), you can load the library like so:
106
+
107
+
```sql
108
+
.load ./regex0
109
+
select regex_version();
110
+
-- v0.1.0
111
+
```
112
+
113
+
Or in Python, using the builtin [sqlite3 module](https://docs.python.org/3/library/sqlite3.html):
I (Alex 👋🏼) spent a lot of time and energy on this project and [many other open source projects](https://github.com/asg017?tab=repositories&q=&type=&language=&sort=stargazers). If your company or organization uses this library (or you're feeling generous), then please [consider supporting my work](https://alexgarcia.xyz/work.html), or share this project with a friend!
143
+
144
+
## See also
145
+
146
+
-[sqlite-xsv](https://github.com/asg017/sqlite-xsv), A SQLite extension for working with CSVs
147
+
-[sqlite-loadable](https://github.com/asg017/sqlite-loadable-rs), A framework for writing SQLite extensions in Rust
148
+
-[sqlite-http](https://github.com/asg017/sqlite-http), A SQLite extension for making HTTP requests
This benchmark isn't exhaustive, and only benchmarks between other widely-used SQLite regex extensions.
6
+
7
+
## `REGEXP()` across all SQLite regex extensions
8
+
9
+

10
+
11
+
Explaination: Essentially running `select count(*) from corpus where line regexp "\d{4}-\d{2}-\d{2}"`, though `regexp` and `sqlean/re` doesn't support `\d` or `{4}` syntax.
0 commit comments