Re: [sqlite] regex -- no clue

2011-01-24 Thread Igor Tandetnik
Gert Van Assche  wrote:
> I read in the documentation  "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
> functionnamed
> "regexp" is added at run-time, that function will be called in order
> to implement the REGEXP operator."
> 
> I don't know how to act on this. What should I do to include a regular
> expression in an SQL query.

You should write and install a user-defined function named "regexp" taking two 
parameters - a string to match and a pattern to match it against - and 
returning a non-zero integer if the string matches the pattern and zero 
otherwise. Once this is done, you can write queries like

select * from myTable where myField regexp 'myPattern';

-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] regex -- no clue

2011-01-24 Thread Gert Van Assche
Hi all,

I read in the documentation  "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
functionnamed
"regexp" is added at run-time, that function will be called in order
to implement the REGEXP operator."

I don't know how to act on this. What should I do to include a regular
expression in an SQL query.

Thanks for your help.

Gert
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users