Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use REGEXP operator? #93

Closed
omicronlab opened this issue Aug 21, 2012 · 5 comments
Closed

How to use REGEXP operator? #93

omicronlab opened this issue Aug 21, 2012 · 5 comments

Comments

@omicronlab
Copy link

Quoting from the sqlite doc:

http://www.sqlite.org/lang_expr.html#regexp

The REGEXP operator is a special syntax for the regexp() user function. No regexp() user function is defined by default and so >use of the REGEXP operator will normally result in an error message. If a application-defined SQL function named "regexp" is >added at run-time, that function will be called in order to implement the REGEXP operator.

Is it possible to add this custom function in node-sqlite3 to support REGEXP operator in sql queries?

@kkaefer
Copy link
Contributor

kkaefer commented Aug 22, 2012

Looks like this could be added by node-sqlite3, e.g. using v8's RegExp or boost regular expressions. I'd be happy to accept a pull request that adds this to node-sqlite3.

@omicronlab
Copy link
Author

Adding custom function with sqlite3_create_function seems intuitive, a quick googling shows python/rails users can write their own custom functions pretty easily:
http://stephen-veit.blogspot.com/2009/03/implementing-regexp-in-sqlite3.html
http://stackoverflow.com/questions/5365451/problem-with-regexp-python-and-sqlite

Problem is node-sqlite3 doesn't expose this API, and I haven't hacked into native node modules so far. Where should I start?

@kkaefer
Copy link
Contributor

kkaefer commented Oct 7, 2013

Closing in favor of #140.

@kkaefer kkaefer closed this as completed Oct 7, 2013
@slawo
Copy link

slawo commented Jan 1, 2015

+1 Would it be possible to add a regexp function in the default node package?

@Mithgol
Copy link
Contributor

Mithgol commented Jan 2, 2015

See #140 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants