On Sun, Jan 27, 2008 at 10:37:28PM +0100, Martin Kersten wrote:
Venks wrote:
Hi,
Does MonetDB has regular expression support in SQL? I am looking to
The PCRE library is linked with the kernel if it is available on the host platform. The primitives are available at the MAL level and it should not be a big problem to make them available at the SQL level too. This indeed might improve your program a lot.
For example the following function is available. command replace(origin:str,pat:str,repl:str,flags:str):str address PCREreplace_wrap comment "Replace _all_ matches of \"pattern\" in \"origin_str\" with \"replacement\".\n\ Parameter \"flags\" accept these flags: 'i', 'm', 's', and 'x'.\n 'e': if present, an empty string is considered to be a valid match 'i': if present, the match operates in case-insensitive mode. Otherwise, in\n case-sensitive mode.\n\ 'm': if present, the match operates in multi-line mode.\n 's': if present, the match operates in \"dot-all\" The specifications of the flags can be found in \"man pcreapi\"\n The flag letters may be repeated.\n No other letters than 'e', 'i', 'm', 's' and 'x' are allowed in \"flags\".\n Returns the replaced string, or if no matches found, the original string."; With the following definition, it could be made available on the sql level CREATE FUNCTION "pcre_replace" (origin string, pat string, repl string, flags string) RETURNS string EXTERNAL NAME pcre."replace"; Niels
remove all alpha characters in a column value and wondering if there is a better way to do so rather than removing one character at a time.
Thanks,
-Venks
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl