Pg_re2: 9x faster regular expressions in Postgres

saisrirampur1 pts0 comments

GitHub - ClickHouse/pg_re2: re2 extension for postgres, compatible with ClickHouse regex · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Uh oh!

There was an error while loading. Please reload this page.

ClickHouse

pg_re2

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>30 Commits<br>30 Commits

.github/workflows

.github/workflows

benchmark

benchmark

doc

doc

sql

sql

src

src

test

test

.clang-format

.clang-format

.gitattributes

.gitattributes

.gitignore

.gitignore

CHANGELOG.md

CHANGELOG.md

LICENSE.md

LICENSE.md

META.json

META.json

Makefile

Makefile

README.md

README.md

re2.control

re2.control

View all files

Repository files navigation

re2 provides ClickHouse regular expression functions with re2

try=# create extension re2;<br>CREATE EXTENSION

try=# SELECT re2match('hello world', 'h.*o');<br>re2match<br>(1 row)

Building

Install re2, then:

make<br>make installcheck<br>make install

If you encounter an error such as:

"Makefile", line 8: Need an operator

You need to use GNU make, which may well be installed on your system as<br>gmake:

gmake<br>gmake install<br>gmake installcheck

If you encounter an error such as:

make: pg_config: Command not found

Be sure that you have pg_config installed and in your path. If you used a<br>package management system such as RPM to install PostgreSQL, be sure that the<br>-devel package is also installed. If necessary tell the build process where<br>to find it:

env PG_CONFIG=/path/to/pg_config make && make installcheck && make install

If you encounter an error such as:

src/re2_wrapper.cpp:14:10: fatal error: 're2/re2.h' file not found

You either need to install re2 or tell the compiler where to find it.<br>If, for example, you installed the Homebrew re2, try:

make CPPFLAGS=-I/opt/homebrew/include \<br>CFLAGS=-I/opt/homebrew/include \<br>LDFLAGS=-L/opt/homebrew/lib

If you encounter an error such as:

utils/pg_locale.h:24:10: fatal error: 'unicode/ucol.h' file not found

Install the ICU development headers Postgres was built against, e.g.<br>libicu-dev on Debian and Ubuntu.

If you encounter an error such as:

ERROR: must be owner of database regression

You need to run the test suite using a super user, such as the default<br>"postgres" super user:

make installcheck PGUSER=postgres

To install the extension in a custom prefix on PostgreSQL 18 or later, pass<br>the prefix argument to install (but no other make targets):

make install prefix=/usr/local/extras

Then ensure that the prefix is included in the following postgresql.conf<br>parameters:

extension_control_path = '/usr/local/extras/postgresql/share:$system'<br>dynamic_library_path = '/usr/local/extras/postgresql/lib:$libdir'

Usage

Once re2 is installed, you can add it to a database by connecting to a<br>database as a super user and running:

CREATE EXTENSION re2;

To install into a specific schema, use the SCHEMA clause:

CREATE SCHEMA env;<br>CREATE EXTENSION re2 SCHEMA env;

Dependencies

re2 extension requires PostgreSQL 13 or higher, & re2.

About

re2 extension for postgres, compatible with ClickHouse regex

Resources

Readme

License

View license

Uh oh!

There was an error while loading. Please reload this page.

Activity

Custom properties

Stars

stars

Watchers

watching

Forks

fork

Report repository

Releases

Release v0.4.1

Latest

Jul 9, 2026

+ 5 releases

Packages

Uh oh!

There was an error while loading. Please reload this page.

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

56.3%

C++<br>17.4%

Python<br>11.9%

PLpgSQL<br>10.4%

Makefile<br>2.9%

Shell<br>1.1%

You can’t perform that action at this time.

error make install extension reload postgres

Related Articles