Giter VIP home page Giter VIP logo

mysql-udf-regexp's Introduction

mysql-udf-regexp

This package impelemnts regular expression functions as MySQL User Defined Functions (UDFs).

The functions implemented by this package are:

REGEXP_LIKE(text, pattern [, mode])
REGEXP_SUBSTR(text, pattern [,position [,occurence [,mode]]])
REGEXP_INSTR?(text, pattern [,position [,occurence [,return_end [,mode]]]])
REGEXP_REPLACE?(text, pattern, replace [,position [,occurence [,return_end [,mode]]])

The functions support the same regular expression syntax as the MySQL REGEXP operator as documented in the Regular Expressions appendix of the MySQL manual.

These functions are very similar to the Oracle SQL functions by the same name. They are not 100% compatible but should be good enough to act as replacements in most common use cases.

mysql-udf-regexp's People

Contributors

hholzgra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql-udf-regexp's Issues

undefined symbol: _db_enter_

Was trying to create the functions after I placed the compiled regexp.so into my /usr/lib/mysql/plugin, but got:

ERROR 1126 (HY000): Can't open shared library 'regexp.so' (errno: 0 /usr/lib/mysql/plugin/regexp.so: undefined symbol: _db_enter_)

Only found http://bugs.mysql.com/bug.php?id=60872 as a reference for this problem, but I don't know exactly how I could deal with it.

Beginning of line anchor doesn't seem to work in REGEXP_REPLACE

Here's a normal replacement, without any anchors (works fine):

mysql> SELECT REGEXP_REPLACE('ABCABC', 'A', '*');
+------------------------------------+
| REGEXP_REPLACE('ABCABC', 'A', '*') |
+------------------------------------+
| *BC*BC                             |
+------------------------------------+
1 row in set (0.00 sec)

If we add the beginning of line anchor, it fails to replace:

mysql> SELECT REGEXP_REPLACE('ABCABC', '^A', '*');
+-------------------------------------+
| REGEXP_REPLACE('ABCABC', '^A', '*') |
+-------------------------------------+
| ABCABC                              |
+-------------------------------------+
1 row in set (0.00 sec)

End of line anchor works fine:

mysql> SELECT REGEXP_REPLACE('ABCABC', 'C$', '*');
+-------------------------------------+
| REGEXP_REPLACE('ABCABC', 'C$', '*') |
+-------------------------------------+
| ABCAB*                              |
+-------------------------------------+
1 row in set (0.00 sec)

Trying to install on a mac

Not really an issue - I'm just trying to install this package on a mac and get this error back with I try to get an error:
./udf_regexp.h:34:11: fatal error: 'regex/my_regex.h' file not found

I bet I am missing something...

Documentation issues

Some minor documentation issues...

  • it was not exactly clear by looking at the top level's README file to figure out that the autogenerated INSTALL file in the regexp subdirectory contains the actual installation procedure
  • "configuring" the mysql tree meant to install cmake and execute cmake . in the MySQL source tree, otherwise the configure script of this extension did not accept the source at all
  • I figured that using --with-mysql-src was not at all possible, instead ./configure CFLAGS="-I/usr/include/mysql -I/path/to/mysql/src" was sufficient as well as an alternative, is this correct?

./libtool: line 860: X--tag=CC: command not found

$ make
make  all-am
make[1]: Entering directory `/usr/home/saper/sw/mysql-udf-regexp/regexp'
if /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.    -I/usr/home/saper/sw/mysql-5.6.31/include -I/usr/home/saper/sw/mysql-5.6.31  -I/usr/home/saper/sw/mysql-5.6.31/sql  -g -O2 -MT regexp_la-regexp.lo -MD -MP -MF ".deps/regexp_la-regexp.Tpo" -c -o regexp_la-regexp.lo `test -f 'regexp.c' || echo './'`regexp.c; \
then mv -f ".deps/regexp_la-regexp.Tpo" ".deps/regexp_la-regexp.Plo"; else rm -f ".deps/regexp_la-regexp.Tpo"; exit 1; fi
./libtool: line 860: X--tag=CC: command not found
./libtool: line 893: libtool: ignoring unknown tag : command not found
./libtool: line 860: X--mode=compile: command not found
./libtool: line 1010: *** Warning: inferring the mode of operation is deprecated.: command not found
./libtool: line 1011: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./libtool: line 1154: Xgcc: command not found
./libtool: line 1154: X-DHAVE_CONFIG_H: command not found
./libtool: line 1154: X-I.: command not found
./libtool: line 1154: X-I.: command not found
./libtool: line 1154: X-I.: command not found
./libtool: line 1154: X-I/usr/home/saper/sw/mysql-5.6.31/include: No such file or directory
./libtool: line 1154: X-I/usr/home/saper/sw/mysql-5.6.31: No such file or directory
./libtool: line 1154: X-I/usr/home/saper/sw/mysql-5.6.31/sql: No such file or directory
./libtool: line 1154: X-g: command not found
./libtool: line 1154: X-O2: command not found
./libtool: line 1154: X-MT: command not found
./libtool: line 1154: Xregexp_la-regexp.lo: command not found
./libtool: line 1154: X-MD: command not found
./libtool: line 1154: X-MP: command not found
./libtool: line 1154: X-MF: command not found
./libtool: line 1154: X.deps/regexp_la-regexp.Tpo: No such file or directory
./libtool: line 1154: X-c: command not found
./libtool: line 1205: Xregexp_la-regexp.lo: command not found
./libtool: line 1210: libtool: compile: cannot determine name of library object from `': command not found
make[1]: *** [regexp_la-regexp.lo] Error 1
make[1]: Leaving directory `/usr/home/saper/sw/mysql-udf-regexp/regexp'
make: *** [all] Error 2

Trying to install on ubuntu

When I trying to install on ubuntu 14.04 LTS I have an error:

ccc@ubuntu:/Desktop/mysql-udf-regexp/regexp$ sudo make install
if /bin/bash ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT regexp_la-regexp.lo -MD -MP -MF ".deps/regexp_la-regexp.Tpo" -c -o regexp_la-regexp.lo test -f 'regexp.c' || echo './'regexp.c;
then mv -f ".deps/regexp_la-regexp.Tpo" ".deps/regexp_la-regexp.Plo"; else rm -f ".deps/regexp_la-regexp.Tpo"; exit 1; fi
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT regexp_la-regexp.lo -MD -MP -MF .deps/regexp_la-regexp.Tpo -c regexp.c -fPIC -DPIC -o .libs/regexp_la-regexp.o
regexp.c:56:23: fatal error: my_global.h: No such file or directory
#include <my_global.h>
^
compilation terminated.
make: *** [regexp_la-regexp.lo] Error 1
ccc@ubuntu:
/Desktop/mysql-udf-regexp/regexp$ locate my_global.h
/usr/include/mysql/my_global.h
Please help

configure on mac os yosemite fails

config.log.zip

System: mac os x yosemite 10.10.5
mysql source: 5.5.38 (/usr/local/mysql)
statement: ./configure --with-mysql-src=/usr/local/mysql-5.5.38/

"checking for mysql source directory... configure: error: not configured yet"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.