View Issue Details

IDProjectCategoryView StatusLast Update
0007244MMW v4Framework: Scripts/Extensionspublic2020-07-01 13:35
Reporterzvezdan Assigned To 
PrioritynoneSeverityfeatureReproducibilityalways
Status newResolutionopen 
Target Version4.1 
Summary0007244: Regular expressions in SQL needed
DescriptionSQLite allows adding of custom functions. It even has reserved REGEXP operator, but it requires adding of regexp() function to the database engine. It would be nice if you add such thing since it would allow very powerful SQL queries.
TagsNo tags attached.
Fixed in build

Relationships

related to 0016746 assignedpetr Implement the latest SQLite, or at least 3.25.0, which have window functions added 

Activities

peke

2011-04-10 22:51

developer   ~0024196

Reminder sent to: jiri, petr

I wonder how I will reflect to MM speed, But REGEXP is surely know of its powers.

zvezdan

2020-06-23 09:41

updater   ~0058633

I doubt that adding such thing could affect the speed of MM if it is not used by program internally. In fact, I am pretty sure that even the program itself could see a benefit of such added functionality.

There is available code for it, I suppose you just need to compile it and include it in the SQLite dll engine:
https://www.sqlite.org/src/raw/ext/misc/regexp.c?name=a68d25c659bd2d893cd1215667bbf75ecb9dc7d4

There are other implementations as well, I suppose they are even better since the previous one is quite limited, but I haven't checked them. For example, it seems that this one based on PCRE looks promising:
https://github.com/ralight/sqlite3-pcre

And if you really decide to implement RegExp, then it would be nice if you add the Regex Replace function as well:
https://github.com/gwenn/sqlite-regex-replace-ext

jiri

2020-07-01 11:51

administrator   ~0058715

As much as I'd like to have regexp in Sqlite, the proper implementation would probably be non-trivial (full Unicode support, without the need to include complete icu library). I'd rather keep relying on scripting implementation of regexp and possibly try to use this implementation in Sqlite in the future (which would probably be non-trivial, but possible).

zvezdan

2020-07-01 13:35

updater   ~0058717

Yeah, I helped implementing a TPerlRegEx class based on PCRE library into one text processor and I know this is not a trivial task. But it is doable and it supports Unicode characters without any problem. For example, I could use [^\x00-\xff] with it to find all non-ANSI characters quite well.