Edgewall Software

Opened 14 years ago

Last modified 4 years ago

#3273 new enhancement

Add REGEXP support to SQL queries

Reported by: david.l.jones@… Owned by:
Priority: normal Milestone: next-major-releases
Component: report system Version: devel
Severity: minor Keywords: sqlite regexp patch
Cc: mmitar@… Branch:
Release Notes:
API Changes:


SQLite allows the use of a REGEXP search [1]. Such a feature would be useful in cases such as parsing multiple CCs, multiple asignees on a ticket [2], etc. All that has to be done is to create a user function on the connection [3].

I've attached a diff of what (I think) will enable this (I am using r3406 currently). The patch will add a user function in SQLite immediately after the connection is made. The user function is called regexp. (See trac_sqlite_regexp_r3406.patch)


  1. http://www.sqlite.org/lang_expr.html: What is currently allowed in SQLite expressions
  2. #2662: Using REGEXP in SQLite to parse multi-user assignments
  3. http://initd.org/pub/software/pysqlite/doc/usage-guide.html#creating-user-defined-functions pysqlite documentation to add a user-defined function

Attachments (1)

trac_sqlite_regexp_r3406.patch (711 bytes ) - added by david.l.jones@… 14 years ago.
Adding regexp to the SQLite connection

Download all attachments as: .zip

Change History (10)

by david.l.jones@…, 14 years ago

Adding regexp to the SQLite connection

comment:1 by Emmanuel Blot, 14 years ago

Milestone: 0.10

comment:2 by anonymous, 14 years ago

Do not forget to catch some exceptions http://initd.org/tracker/pysqlite/wiki/SnippetsRegexp

comment:3 by Christian Boos, 13 years ago

Milestone: 0.12

Since PostgreSQL and MySQL both have native support for regular expressions, we could indeed add this capability to the SQLite backend.

comment:4 by david.l.jones@…, 13 years ago

Although this would be useful for some specific back end parts, this would probably be most useful for adding to search, especially when searching changesets.

comment:5 by Remy Blank, 10 years ago

Owner: daniel removed

comment:6 by Carsten Klein <carsten.klein@…>, 9 years ago

see also #8914 for a patch. however, #8914 is definitely a duplicate of this.

comment:7 by Mitar, 9 years ago

Cc: mmitar@… added

comment:8 by Carsten Klein <carsten.klein@…>, 9 years ago

I have ported the patch to the latest trunk available at github.com.

You can find it under https://github.com/axnsoftware/trac-bugs-n-features/tree/trac-issue-3273

Feel free to further test it. I originally tested it with sqlite. It would be nice, if you could test this with postgresql and mysql, if you happen to use use a db backend.

comment:9 by figaro, 4 years ago

Keywords: patch added

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.