.Dd March 22, 2013 .Os SQLite\ UDF .Dt REGEX \&3s "SQLite User-defined Functions" .Sh NAME .Nm regex .Nd Apply regular expression to a string or column .Sh LIBRARY SQLite User-defined function Library (regex.so) .Sh SYNOPSIS select .Pf regex( Ar pattern , data Ns ); .Sh DESCRIPTION The .Nm function compiles .Ar pattern as an extended regular expression using .Xr regcomp 3 and executes .Xr regexec 3 for .Ar data . It returns .Ql T or .Ql F to indicate a match (or nonmatch). .Sh EXAMPLES .Bd -literal sqlite> \f[CB].load /usr/local/lib/sqlite3/regex.so\f[] sqlite> \f[CB]create virtual table t using readdir (/tmp/eg);\f[] sqlite> \f[CB]select *, regex('^..$', name) from t where name like 'm%';\f[] fileno type name fullname regex('^..$', name) ---------- ---------- ---------- ----------- ------------------- 13630381 l man /tmp/eg/man F 13630382 l me /tmp/eg/me T 13630383 l misc /tmp/eg/mis F 13630384 l mk /tmp/eg/mk T 13630385 l ms /tmp/eg/ms T .Ed .Sh IMPLEMENTATION NOTES This implementation was written to use the regular expression functions provided in the NetBSD standard C library. With minor modifications it could be adapted to the GNU or PCRE versions. .Pp To use .Nm in the SQLite shell .Ic sqlite3 , add the following to your .Pa ${HOME}/.sqliterc file: .Bd -literal \&.load /usr/local/lib/sqlite3/regex.so .Ed .Sh SEE ALSO .Xr stat 3s .Xr strmode 3s .Pp The above SQLite user-defined functions are intended for use with .Nm . .Sh AUTHORS .Nm was contributed by James K. Lowden .\" .Sh BUGS