File: README.md

package info (click to toggle)
sqlite3-pcre2 0.1.1~git20220105-e3e02a4a-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 140 kB
  • sloc: sh: 193; ansic: 134; sql: 103; makefile: 38
file content (76 lines) | stat: -rw-r--r-- 1,856 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Sqlite3-pcre2: Regex Extension
This is sqlite3-pcre2, an extension for sqlite3 that uses libpcre2 to provide the REGEXP() function.

The original source code was written by Alexey Tourbin and can be found at:
[http://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git](http://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git)

## Build

### Prerequisite

#### Debian

```bash
sudo apt-get install \
    libsqlite3-dev \
    libpcre2-dev
```

### Installation
```bash
git clone https://github.com/christian-proust/sqlite3-pcre2
cd sqlite3-pcre2
make
make install
```

### Development

The tests and the documentation can be generated using:

```bash
make check
make doc
```

See [test](test) documentation.


## Usage

### REGEXP instruction
```sql
-- Test if asdf starts with the letter A with the case insensitive flag
SELECT 'asdf' REGEXP '(?i)^A'
; -- => 1
-- Test if asdf starts with the letter A
SELECT 'asdf' REGEXP '(?i)^A'
; -- => 0
```


## PCRE2 library

The documentation of the PCRE2 library can be found at: [http://pcre.org/](http://pcre.org/).

The regular expression syntax documentation can be found [https://perldoc.perl.org/perlre](here).


## Changelog

### 2021 UPDATE

- Rename the lib from pcre.so to pcre2.so.
- Use the libpcre2 instead of libpcre.
- Handle a NULL value for both pattern and subject.
- Handle a NULL character into a string.


### 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. (credit to @santiagoyepez for a less hacky fix of explicitly checking for nulls)

### 2006-11-02 Initial version

The original source code was written by Alexey Tourbin and can be found at:
[http://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git](http://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git)